本文介绍了如何自动响应 Linux Bash 脚本中的提示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在运行一个脚本(我无法编辑它),有三个是/否问题.我如何自动回答这些问题?我需要回答是,是,否(按此顺序).
I am running a script (I can't edit it), and there are three yes/no questions. How can I automatically respond to these questions? I need to answer yes, yes, no (in that order).
推荐答案
试试这个:
echo -e "yes
yes
no" | /path/to/your/script
来自help echo
:
-e
:启用对以下反斜杠转义的解释
这篇关于如何自动响应 Linux Bash 脚本中的提示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!