By editor, 9 February, 2017 Question How do I prompt for Yes/No/Cancel input in a Linux shell / bash script ? Ask question / input value. Prompt for Yes/No/Cancel input in a Linux shell / bash script Example: #!/bin/bash echo "This script will ask a question."; while true; do read -p "Do you want to continue ?" yn case $yn in [Yy]* ) break;; [Nn]* ) exit;; * ) echo "Please answer yes or no.";; esac done echo "Your answer is 'YES'"; Tags Linux Shell Comments You must have JavaScript enabled to use this form. Your name Subject Comment About text formats Plain text No HTML tags allowed. Lines and paragraphs break automatically. Web page addresses and email addresses turn into links automatically.
Comments