SEARCH - search the EXEC command line for options.

$*$SeaRch var keyword
searches the command line arguments for a match for "keyword" and then puts the match into the user variable. "keyword" may have any of the following forms:
 keyword
+keyword
-keyword
 keyword=
A "keyword" for $*$SeaRch is specified with uppercase letters signifying necessary characters to match, and lowercase letters signifying letters that may be omitted in abbreviations. For example,
$*$search x KeYword
indicates that the minimal abbreviation for KeYword is "ky".

If the $*$SeaRch command specifies "keyword=", EXEC scans its command line for

string=value
where "string" matches "keyword". The accompanying "value" is assigned to "var". If the $*$SeaRch command specifies one of the other keyword forms, EXEC assigns any matching string to "var". For example, if EXEC finds the string "+keyword", it assigns "+keyword" to "var".

When EXEC finds a matching argument, it removes the argument from the argument list (so that it will not be found again.) EXEC removes the argument in the same way that it does a $*$SHift action.

EXEC creates the variable "var" if it doesn't already exist. If there is no argument that matches the specified "keyword" form, "var" remains undefined. See the main explain file "expl exec" for more on undefined values.

$*$SeaRch var keyword :statement
is similar to the previous form of $*$SeaRch. If EXEC finds "keyword" on the command line, it assigns the value to "var" and then executes "statement"; if EXEC does not find "keyword", "statement" is not executed. The "statement" can be either a system command or an EXEC directive.

Copyright © 2000, Thinkage Ltd.