next up previous contents index
Next: The shell Command Up: Shell Commands Previous: The rehash Command   Contents   Index

The set Command

The set command allows the user to examine and set shell variables. It is also possible to assign vectors with the set command.

set [varname [= value] ...]
In addition, shell variables are set which correspond to definitions supplied on the .options line of the current circuit, and there are additional shell variables which are set automatically in accord with the current plot. The shell variables that are currently active can be listed with the set command given without arguments, and are also listed within the Variables window brought up from the Tools menu of the Tool Control window. In these listings, a `+' symbol is prepended to variables defined from a .options line in the current circuit, and a `*' symbol is prepended to those variables defined for the current plot. These variable definitions will change as the current circuit and current plot change. Some variables are read-only and may not be changed by the user, though this is not indicated in the listing.

Before a simulation starts, the options from the .options line of the current circuit are merged with any of the same name that have been set using the shell. The result of the merge is that options that are booleans will be set if set in either case, and those that take values will assume the value set through the shell if conflicting definitions are given. The merge will be suppressed if the shell variable noshellopts is set from the shell, in which case the only options used will be those from the .options line, and those that are redefined using the set command will be ignored.

Above, the varname is the name of the shell variable to set, and value, if present, is a single token to be assigned. Multiple variables can be assigned with a single set command. If value is missing (along with the `='), then varname is of boolean type and always taken as ``true'' when set. If value is a pure number not double quoted, then varname will reference that number. Otherwise, varname will reference value as a character string, unless value is a list. A list is a space-separated list of tokens in space-separated parentheses, as in

set mylist = ( abc def 1.2 xxdone )
which sets the variable mylist to the list of four tokens. The unset command can be used to delete a variable.

The value of a variable word may be inserted into a command by writing $word. If a variable is set to a list of values that are enclosed in parentheses (which must be separated from their values by white space), the value of the variable is the list.

The set command can also be used to assign values to vectors (vectors are described in 3.16). The syntax in this case is

set &vector = value

which is equivalent to

let vector = value

When entering this form from the WRspice command line, the `&' character must be hidden from the shell, perhaps most conveniently be preceding it with a backslash. The value must be numeric, and a value must be given, unlike for a variable which can be set as a boolean.

There are a number of variables with internal meaning to WRspice, and in fact this is the mechanism by which most WRspice defaults are specified. Several of the other buttons in the Tools menu, including Commands, Debug, Plot Opts, Shell, and Sim Opts bring up panels from which these special variables can be modified.

The predefined variables which have meaning to WRspice (see 4.10) can be listed with the usrset command. In general, variables set in the .options line are available for expansion in $varname references, but do not otherwise affect the functionality of the shell.

next up previous contents index
Next: The shell Command Up: Shell Commands Previous: The rehash Command   Contents   Index
Stephen R. Whiteley 2022-09-18