且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 shell 脚本执行期间处理用户提示/用户干预

更新时间:2023-09-18 10:31:28

您可以尝试 expect 工具,该工具用于将输入自动提供给交互式程序.尝试从这样的事情开始:

You can try expect tool which is used to feed input automatically to an interactive program. Try to begin with something like this:

#!/usr/bin/expect

set timeout 10

spawn "PATH_TO/a.sh"
expect "You want to Proceed" 
send "y\r"

interact