小编Pet*_*ter的帖子

bash 脚本中类似`expect`的行为

我有一个脚本(让我们命名它parent.sh),它根据输入参数调用其他一些脚本。

最后,它调用脚本child.sh
child.sh请求用户输入,以防它发现某些文件已经存在:

"Would you like to replace the configuration file with a new one? (Yes/No/Abort): "
Run Code Online (Sandbox Code Playgroud)

现在,我想这样做是为了模拟的按键“Y” /“Y”里面parent.sh的脚本,以便始终覆盖文件。

无法使用expect.

我怎样才能做到这一点?

bash

6
推荐指数
1
解决办法
6230
查看次数

标签 统计

bash ×1