October 2001
Intermediate to advanced
1040 pages
22h 50m
English
If you are writing scripts that require a number of command line options, positional parameters are not always the most efficient. For example, the UNIX ls command takes a number of command line options and arguments. (An option requires a leading dash; an argument does not.) Options can be passed to the program in several ways: ls –laFi, ls –i –a –l –F, ls –ia –F, and so forth. If you have a script that requires arguments, positional parameters might be used to process the arguments individually, such as ls –l –i –F . Each dash option would be stored in $1, $2, and $3, respectively. But, what if the user listed all of the options as one dash option, as in ls –liF? Now the –liF would all be ...