# $EPIC: getopt.txt,v 1.4 2007/03/02 02:32:04 jnelson Exp $
$getopt(<optopt-var> <optarg-var> <option-list> <argument-list>)
Useful when you want an alias to accept option flags and you need a way to parse them easily. See the example section for particulars.
See technical specification for return values.
alias myalias { 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} } } echo * remaining args: $optarg }