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
#!/bin/bash echo "Provide some input :" read XYZ echo "You have typed $XYZ"
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.