creating a linux shell script with variable with user input form prompt to enter data
RegisterLogin
Webune Forums » Linux Commands » creating a linux shell script with variable with user input form prompt to enter data
creating a linux shell script with variable with user input form prompt to enter data
Post Description: creating a linux shell script with variable with user input form prompt to enter data
Tags: creating, a, linux, shell, script, with, variable, with, user, input, form, prompt, to, enter, data
This Post Was Posted On Feb 29, 2008 By linux #573
Post Description: creating a linux shell script with variable with user input form prompt to enter data
Tags: creating, a, linux, shell, script, with, variable, with, user, input, form, prompt, to, enter, data
This Post Was Posted On Feb 29, 2008 By linux #573
creating a linux shell script with variable with user input form prompt to enter data by linux
at the command line, we can create variables explicityly by telling the shell the name of the variable and the value of assign. to do this, just follow these steps on my tutorial for you to learn how to program in linux
1. run these commands
a=1650
echo $a
the sh family of shells also creates variables with input read from the user.
echo $a
2. enter this command
read xxx
No prompt is displayed but the shell is waiting for input from you
3. enter this command
Wallpaperama
4. enter this command
echo $xxx
a new variable named xx is created with a value of Wallpaperama. in this example, the shell interprets the read command as instruction to create a new variable using the argument to read as the new rabiable's name, and then to assign the varaible the value of wahtever the user types in until the next enter. the same procedure can be used tom odify the value of an exisitng variable
5. enter this command
read xxx
6. enter this
Get Free Wallpapers at Wallpaperama
7. enter this command
echo $xxx
the shell interprest the argument to the read command as the name of a variable and interprets whatever the user types until the next ENTER as the value ot assing to the variable. if the variable exits, its value is modigfied. if the variable does not exists, the shell crates it. a varable consisting of many words is acceptable. I am familiar with php, if you are also familiar in programming with php and HTML, think of read as a web form where you ask for user input, on the form itself, you use variables to declare user input. same here with the read utility in linux.
Leave Your Comments
Related Pages: [Add Your Website]
Post New Topic
tuiz
#742 1
this is great
Mar 22, 2008 Reply Report abuse
kila
#741 2
can you pls list the command for me to prompt the user to enter name
May 14, 2007 Reply Report abuse
©2011 Webune Forums - Tue Dec 20, 2011 5:41 am
Powered by: Webune Forums V3
Powered by: Webune Forums V3