Skip to content

Instantly share code, notes, and snippets.

@clarksun
Created September 27, 2017 05:34
Show Gist options
  • Save clarksun/31992608bdb601e83991b4037911c33b to your computer and use it in GitHub Desktop.
Save clarksun/31992608bdb601e83991b4037911c33b to your computer and use it in GitHub Desktop.
shell提示是否运行
# https://stackoverflow.com/questions/226703/how-do-i-prompt-for-yes-no-cancel-input-in-a-linux-shell-script
while true; do
read -p "Do you wish to install this program?" yn
case $yn in
[Yy]* ) make install; break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment