WILDCARDS -- Summary of Shell Wildcard Syntax and Usage 83/08/08
(You may find a more complete description of the following features in the
Command Shell chapter of the "DOMAIN System Command Reference Manual".)
Wildcards are text strings which provide a shorthand way to represent one or
more existing naming server pathnames. Regular expressions are used in place
of directory entry names to specify which names at the corresponding point in
the naming tree will match. (For a description of regular expression
construction, type HELP PATTERNS.) One or more regular expressions,
optionally preceded by "/", "//", "~", or ".", and separated by "/" or "\",
form a wildcard.
DIFFERENCES FROM DM REGULAR EXPRESSIONS
The regular expressions used in wildcards deviate slightly from those used in
the Display Manager. These deviations are:
1. Each regular expression is assumed to be preceded by "%" (the
beginning-of-line character) and followed by a "$" (the
end-of- line character). These characters may NOT be supplied
explicitly. (N.B. Were it not for this deviation, the wildcard
name "?" would match any name, instead of only 1-character names.)
2. When "%" is found in a wildcard, it is replaced by the regular
expression "[~.]*", which means 'all characters up to but not
including the next period'. This introduces the notion of
"components" within entry names, where a component is a character
string which is delimited by periods or either end of the name.
"%" will match zero or more characters.
The symbol "..." (ellipses) may be used in place of an entry name to indicate
that any number of directory names (including zero) may appear in its place.
For each directory which satisfies the portion of the wildcard to the left of
the ellipses, it and all subdirectories are searched for entries which satisfy
the portion of the wildcard to the right of the ellipses. Ellipses may appear
any number of times in a wildcard.
EXAMPLES
Examples of wildcards are:
zork "zork", contained in the working directory.
z?* all names which begin with "z", contained in the
working directory.
/fred/?* all names contained in the directory "/fred"
/... all names contained in "/" and all directories
thereunder (includes the name "/")
/?*/... same as above, but excludes the name "/"
/.../curmudgeon.% all 2 component names whose first component is
"curmudgeon", anywhere under the "/" directory
//lang/.../?*.bak all names under the "//lang" directory which end
in ".bak"
... all names under the working directory
~[a-m]?*/?*.ftn all names which end in ".ftn" contained in
directories whose names start with the
characters 'a' thru 'm', under the naming
directory
DERIVED NAMES
Some commands accept two or more names which are logically related. These
commands include CHN (CHANGE_NAME)- from and to names; CPF (COPY_FILE)
- source and destination; CMT (COMPARE_TREE) - names of the two trees being
compared; and others. The second (and subsequent) names are called "derived
names", because they may be syntactically derived from the first name. The
syntax for derived names is similar to that used in the right-hand side of a
Display Manager or ES "substitute" operation, with the exception that the
ampersand ("&") character is replaced by an equal-sign ("="). (A word of
explanation: The shell uses the "&" to signify that this command is to be
executed in another process. This makes the ampersand unavailable.)
EXAMPLES
Examples of derived name usage are:
chn ziggy.pas =.old renames "ziggy.pas" to "ziggy.pas.old"
cpf /{?*.pas} /src/@1 copies all files with the suffix ".pas" in
the root directory to the "/src" directory,
preserving their leaf names
chn {frank.pas}.bak @1 renames "frank.pas.bak" to "frank.pas".