Category: Bash Scripts

Added: 2nd of August 2022

Viewed: 1,114 times

Related Tips & Tutorials

Create a simple bash script in Ubuntu and Ubuntu based distributions

Getting user input bash scripts

The following bash script gets the user input by using the read command and then printing out the results in the terminal.

If this is your first time creating a bash script please visit my other tutorial Create a simple bash script

Copy and past the code below in to your text editor, save the file as


echo "What is your name?"
read name
echo "How old are you?"
read age
echo "Hello $name, you are $age years old"

Make the file executable by entering the following command
chmod +x

Run the script by entering