GNU Rush – a restricted user shell (split by node):   Section:   Chapter:FastBack: Configuration File   Up: Rule   FastForward: Default Configuration   Contents: Table of ContentsIndex: Concept Index

4.4.3 Modifying variables

Rules can change or unset variables. Two separate groups of statements are provided to that effect. The set, unset, and map statements operate on positional, request, and user-defined variables. The setenv, unsetenv, clrenv, and keepenv statements modify the environment. These will be discussed in a separate subsection (see Environment).

Modifications to positional and request variables deserve a special explanation.

The only two request variables that can be modified (but not unset) are $command and $program.

Positional variables and the $command request variable are mutually dependent. If the $command is modified, the word splitting is applied to it and resulting words are assigned to the positional variables. Similarly, any modifications to positional variables trigger rebuilding of the $command variable from the modified arguments. Both operations are run immediately after the change that triggered them. Notice, however, that any transformations, including variable modifications, are executed after match statements have been evaluated, so that match always operates on unchanged variables, no matter where in the rule you place it,

If the rules result in accepting the request, then modified $command becomes the actual command that rush will execute.

Obviously, none of the request variables can be unset. You can however, unset a positional variable (excepting ‘$0’). It is equivalent to removing the corresponding argument from the command line.

GNU Rush – a restricted user shell (split by node):   Section:   Chapter:FastBack: Configuration File   Up: Rule   FastForward: Default Configuration   Contents: Table of ContentsIndex: Concept Index