How to read user input in bash script

Many times we need to provide user input to the bash script to take actions accordingly. We can use bash builtin “read” command for same. Let’s see a quick example


As we see we are reading input to a runtime variable named as “XYZ”. We can use value of the variable anywhere in the script once we have the value.

Leave a Reply

Your email address will not be published. Required fields are marked *