getopt
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | getopt [2007/03/02 02:32] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | # $EPIC: getopt.txt, | ||
+ | ======Synopsis: | ||
+ | $__getopt__(< | ||
+ | |||
+ | ======Technical: | ||
+ | * The < | ||
+ | * This function should be called as the expression of a [[WHILE]] command. | ||
+ | * If the < | ||
+ | * If the < | ||
+ | * If the < | ||
+ | * The < | ||
+ | * The < | ||
+ | * The < | ||
+ | * The < | ||
+ | * The < | ||
+ | * Each and every time any of the arguments to the getopt() function change between one call and the next, \\ it is considered the "first time" that the $getopt() function has been called. | ||
+ | * The return value of the function shall be an indicator of the " | ||
+ | * Five things can be returned each call to $getopt(). | ||
+ | * The name of an option that does not take an argument: \\ $< | ||
+ | * The name of an option that takes an argument: \\ $< | ||
+ | * A hyphen (' | ||
+ | * A bang (' | ||
+ | * An empty string indicates processing is complete or internal error: \\ $< | ||
+ | |||
+ | ======Practical: | ||
+ | Useful when you want an alias to accept option flags and you need a | ||
+ | way to parse them easily. | ||
+ | |||
+ | ======Returns: | ||
+ | See technical specification for return values. | ||
+ | |||
+ | ======Examples: | ||
+ | < | ||
+ | alias myalias { | ||
+ | while (option = getopt(optopt optarg " | ||
+ | switch ($option) { | ||
+ | (a) {echo * option " | ||
+ | (b) {echo * option " | ||
+ | (c) {echo * option " | ||
+ | (!) {echo * option " | ||
+ | (-) {echo * option " | ||
+ | } | ||
+ | } | ||
+ | echo * remaining args: $optarg | ||
+ | } | ||
+ | </ | ||
getopt.txt · Last modified: 2007/03/02 02:32 by 127.0.0.1