【发布时间】:2014-08-04 07:17:04
【问题描述】:
当我在服务器上运行两次时,它会多次询问 yes/no 几乎 100 次。我厌倦了每次都输入yes。有什么方法可以运行该脚本,只需将 yes 作为默认选项。假设以下是我的脚本!仅供参考,我无法编辑我的脚本。
只是我可以使用./ittp-update.sh 运行它
#!/bin/bash
echo "Do you need to install the necessary compiling tools?"
select yn in "Yes" "No"; do
case $yn in
Yes ) sudo apt-get install tools; break;;
No ) <Here I want to skip to the next step. I originally left it
blank and removed the "done" command (after esac command)
to do this, but if I choose yes, it skips to the end
(where the next "done" command is and ends the script>
esac
echo "Do you need to eidt your configuration?"
select ny in "No" "Yes"; do
case $ny in
No ) <what do I put here to skip to the next tag
(labeled compile for example purposes); break;;
Yes )
esac
echo "You have 3 options with how you can edit you config file."
....
【问题讨论】:
-
要扩展@Ken 的评论:
yes | ./ittp-update.sh将回答yes的所有 个问题(通过输入yes后跟一个新行一遍又一遍)。跨度>