next up previous contents index
Next: Quoting Up: The WRspice Shell Previous: Alias Substitution   Contents   Index


Global Substitution

The characters ~, {, } have the same effects as they do in the C-Shell, i.e., home directory and alternative expansion. In alternative expansion, if a token contains a form like ``{foo,bar,baz}'', the token is replicated with each replication containing one of the list items from the curly braces replacing the curly brace construct. For example, the string ``stuff{string1,string2,...stringN}morestuff'' is replaced by the list of words ``stuffstring1morestuff stuffstring2morestuff ... stuffstringNmorestuff''. Curly braces may be nested. A particularly useful example is

plot v({4,5,7})
which is equivalent to
plot v(4) v(5) V(7)

The string ~user (tilde at the beginning of a word) is replaced by the given user's home directory, or if the first component of the pathname is simply ``~'', the current user's home directory is understood.

It is possible to use the wildcard characters *, ?, [, and ] to match file names, where * denotes 0 or more characters, ? denotes one character, and [...] denotes one of the specified characters, but these substitutions are performed only if the variable noglob is unset. The pattern [^abc] will match all characters except a, b, and c. The noglob variable is normally set so that the symbols have their usual meanings in algebraic expressions. This can be unset with the unset command if command ``globbing'' is desired.


next up previous contents index
Next: Quoting Up: The WRspice Shell Previous: Alias Substitution   Contents   Index
Stephen R. Whiteley 2022-09-18