getopt
Synopsis:
$getopt(
Technical:
Processes a list of switches and args. Returns one switch char each time it's
called, sets $<optopt var>
Syntax for
If a switch requires an
argument, but the argument is missing, $getopt( ) returns a '-' If a
switch is given which isn't in the opt string, the function returns a
'!' $
Returns:
Returns a switch char.
Examples:
while (option = getopt (optopt optarg "ab:c:" $*)) {
..switch ($option) {
....(a) { echo * option "$optopt" used }
....(b) { echo * option "$optopt" used - $optarg }
....(c) { echo * option "$optopt" used - $optarg }
....(!) { echo * option "$optopt" is an invalid option }
....(-) { echo * option "$optopt" is missing an argument }
.. }
}