Shell-script - How to read user input from keyboard, Bash scripting read user input

How to read user input from keyboard

To read the user input you have to use the keyword "read" without quotes.

  echo "What is your name:"
  read name
  echo "Welcome $name"

Copy the above shell script and place it in a file called myshell.sh


[w3cal@localhost]# sh myshell.sh

  Enter file name:
  Jack
  welcome Jack

The user defined variable name will have the user input and it can be used at any place as you need.

The topic on Shell-script - How to read user input from keyboard is posted by - Patel

Hope you have enjoyed, Shell-script - How to read user input from keyboardThanks for your time

Tech Bluff