Shell Script Tutorial-Get user input using read command

Shell script is a fun and a powerful one if we can use it properly. As a newbie, I wrote this tutorial especially as a personal note but if you found it useful, you may adopt it to your own script. On this tutorial, I am going to learn about Read command. Read command is used to get the user input. We can then use the result from read command for other purposes.


Create a new shell script called You can use your favorite text editor such as Atom, nano or any others. I am using nano on this tutorial.

Now enter the following commands inside the editor:

Now make the script executable with this command

Now run the script


As you can see the echo command display the user input after the script executed.


Leave a Reply

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