We will provide a simple example of the “read” statement showing how you can interact with an end-user. Note, that in this example we are not handling errors, since we want to keep it simple. Let’s create the read.sh
script.
echo "Enter your First Name: " read FIRSTNAME echo "Enter your Last Name: " read LASTNAME echo "" echo "Your Full Name is $FIRSTNAME $LASTNAME" echo "" echo "Enter your Age: " read AGE echo "Next year, you will be `expr $AGE + 1` years old."
Let’s run it now.
Note how we wrote the expression using the backticks expr $AGE + 1