GNU Rush |
|
Restricted User Shell |
Sergey Poznyakoff |
Rush performs word splitting using the same rules as sh
.
Statements in the configuration file refer to command line arguments
(words) by their index, using positional variables.
A positional variable can have the following forms:
$n ${n}
where n is the variable index. The form with curly braces must be used if n is negative (see below) or greater than 9.
Arguments are numbered from ‘0’. The name of the command is argument ‘$0’. Consider, for example, the following command line:
/bin/scp -t /upload
Word splitting phase results in three positional variables being defined:
Variable | Value |
---|---|
$0 | /bin/scp |
$1 | -t |
$2 | /upload |
These values can also be referred to using negative indexes. They refer to words in the reverse order, as illustrated in the following table (notice the use of curly braces):
Variable | Value |
---|---|
${-3} | /bin/scp |
${-2} | -t |
${-1} | /upload |
Notice also, that negative indexes are 1-based.
One final note about the ‘$0’ variable. Immediately after word
splitting it refers to both the executable program name and the 0th
argument that will be passed to that program (argv[0]
). Most
of the time the two values coincide. However, the rule can modify
either value, so that they become different. Whether modified or not,
the actual name of the program to be run is kept in the request
variable ‘$program’ (see the following section).
This document was generated on January 2, 2022 using makeinfo.
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.