Linux Shell Scripting Tutorial (LSST) v1.05r3 | ||
Chapter 2: Getting started with Shell Programming | ||
|
Use to get input (data from user) from keyboard and store (data) to variable.
Syntax:
read variable1, variable2,...variableN
Following script first ask user, name and then waits to enter name from the user via keyboard. Then user enters name from keyboard (after giving name you have to press ENTER key) and entered name through keyboard is stored (assigned) to variable fname.
$ vi sayH |
Run it as follows:$ chmod 755 sayH
$ ./sayH
Your first name please: vivek
Hello vivek, Lets be friend!
| ||
Exit Status | Wild cards (Filename Shorthand or meta Characters) |