Skip to content

Instantly share code, notes, and snippets.

@synackme
Created February 17, 2016 15:23
Show Gist options
  • Save synackme/f41560a970c55a28b04c to your computer and use it in GitHub Desktop.
Save synackme/f41560a970c55a28b04c to your computer and use it in GitHub Desktop.
How to prompt for 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