October 2001
Intermediate to advanced
1040 pages
22h 50m
English
Information can be passed into a script via the command line. Each word (separated by whitespace) following the scriptname is called an argument.
Command line arguments can be referenced in scripts with positional parameters; for example, $1 for the first argument, $2 for the second argument, $3 for the third argument, and so on. After $9, curly braces are used to keep the number as one number. For example, positional parameter 10 is referenced as ${10}. The $# variable is used to test for the number of parameters, and $* is used to display all of them. Positional parameters can be set or reset with the set command. When the set command is used, any positional ...
Read now
Unlock full access