February 2001
Beginner to intermediate
448 pages
9h 2m
English
You have already seen several scripts using command-line arguments. As a script is started, the initiating shell searches for extra data on the command line. Anything beyond the script name is treated as a command-line argument and is placed in shell variables. The shell variables used for command-line storage are named $1 (first argument), $2 (second argument), and so on. These are also referred to as positional parameters because the position of the argument determines the name of the shell variable into which it is placed. Table 8.1 provides a list of the positional and special parameters available to you within your shell script.
| Parameter | Meaning |
|---|---|
| 0 | Name of script, shell, ... |
Read now
Unlock full access