next up previous contents index
Next: The !unset Command: Unset Up: Variables Previous: Variables   Contents   Index


The !set Command: Set Variables

Syntax: !set name [value]
The !set command is used to set variable name to value. The name is the first token following !set, and value represents the rest of the line (which may be empty). White space is stripped from the front of the first word in value and after the last word in value. If value is blank, the variable is understood as a boolean, and is ``set''.

Any variable name can be set in this manner, though there are a number of variables with predefined names which have significance to Xic operation, which are listed in Appendix E. Furthermore, device properties can be set with a variant of this command. A variable which has been set can be removed with the !unset command.

In the !set command, tokens in the value string of the form $(setvar) are expanded to the string associated with setvar, if setvar has been set previously. This applies if setvar was set with the !set command or related script functions, or if setvar is set in the environment, i.e., is an environment variable (see 2.5). If setvar is not resolved, no change is made. Otherwise, in general, the token is replaced with the value of setvar.

There is an exception to the direct-substitution rule. If any substitution string is of the form ``(...)'', then the parentheses and leading/trailing white space are stripped before substitution, and the entire substituted string is enclosed in parentheses if it is not already. This is for convenience when adding a directory to a search path (see 2.6) variable, and the path is enclosed in parentheses, when using forms like

!set path dir $(path)
In this case, the modified substitution rule ensures that dir is logically placed in front of the search path in path. For example, if path is
( /dir1 /dir2 )
then after the substitution implied above, one has
path = ( dir /dir1 /dir2 )
which is correct. If the direct substitution was applied instead, this would give
path = dir ( /dir1 /dir2 )
which is garbage as interpreted as a search path.


next up previous contents index
Next: The !unset Command: Unset Up: Variables Previous: Variables   Contents   Index
Stephen R. Whiteley 2017-03-22