The read Statement

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 testscript
#Script to read your name from key-board
#
echo "Your first name please:"
read name
echo "Hello $name, Lets be friend!"

Run it as follows:
$ chmod 755 testscript
$ ./testscript
Your first name please: vivek
Hello vivek, Lets be friend!

--

No comments:

Other Articles

Enter your email address: