GETOPT(1) | User Commands | GETOPT(1) |
getopt - parse command options
set -- `getopt optstring $*`
getopt rearranges command options for shell scripts. It accepts an optstring argument like getopt(3), i.e. a list of characters (bytes) where each character represents an option letter. A character followed by : indicates that the option has an argument. When an argument list is passed to getopt, it prints it such that each option forms a separate argument, with option and option argument separated by a space, and a `--' separates options and remaining non-option arguments. For example, `getopt a:bc -bc -aarg' results in the output `-b -c -a arg --'.
sh(1)
getopt cannot handle arguments that contain white space. For this reason, the shell special command getopts is preferred over getopt.
6/24/05 | Heirloom Toolchest |