Bash script: YES NO prompt example - JohnHau/mis GitHub Wiki

Interactive Bash scripts will often include a yes or no prompt in order to ask for user verification before proceeding with a set of instructions or canceling the procedure.

If a user answers yes to the prompt, the Bash script will typically proceed with its task, and if a user answers no, the script will either exit or move on to a different part of the script.

In this tutorial, you will see how to create a yes/no prompt in a Bash script on a Linux system. See some of our examples below to learn how a yes/no prompt works.

In this tutorial you will learn:

How to create a yes or no prompt in Bash How to loop a yes or no prompt for invalid responses How to check for lowercase or uppercase responses

Bash script: YES/NO prompt example

image

image

image

image

image

image