我有一个 tcl 脚本,在执行点和给定条件下,我想要启动提示符 (%) 的选项。
类似的东西
# ... previous program logic
if { some_condition } {
# start shell prompt within current execution context
}
else
# continue execution
谢谢。
最佳答案
也许最好使用 tclreadline
包在脚本中启动提示!
类似这样的东西:
package require tclreadline
# ... previous program logic
if { some_condition } {
# Start the shell prompt
set prompt "% "
while {[gets [tclreadline::readline $prompt] line] != -1} {
# Handle user input
# ...
}
}
else {
# continue execution
# ...
}
如您所见,我首先加载 tclreadline
包,如果 some_condition
为 true,我会启动一个 while
循环,反复提示用户使用 tclreadline::readline
命令进行输入!
祝你好运!
关于tcl - 是否有 tcl 命令可以在脚本中启动 shell 提示符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76568625/