Linux Today: Linux News On Internet Time.
Search Linux Today
Linux News Sections:  Developer -  High Performance -  Infrastructure -  IT Management -  Security -  Storage -
Linux Today Navigation
LT Home
Contribute
Contribute
Link to Us
Linux Jobs


Top White Papers

More on LinuxToday


Positional Parameters in the Bash Shell

Jan 31, 2011, 21:05 (0 Talkback[s])

[ Thanks to Andrew Weber for this link. ]

"Special built-in environmental variables are positional parameters which hold command-line arguments to positions with the names 1,2,3,4, etc. which are indicated by $1,$2,$3,$4, etc. Argument $0 is the name of the script. These parameters are named positional because within the script the reference is to the position they occur on the command line.

"These positional variables can be used by a script. Those used typically are variables $0-$9 and $#. Once you have created a script and you name and execute the script you can begin using these positional parameters. For a script named param.sh, when you call the script you can follow the script name with variables. Here is an example:

"sh param.sh server mail"

Complete Story

Related Stories: