GNU Rush |
|
Restricted User Shell |
Sergey Poznyakoff |
The ‘map’ statement uses file lookup to find a new value for the command line word.
Arguments are:
Argument index, as in indexing.
Name of the map file. It must begin with ‘/’ or ‘~/’. Before using, the file permissions and ownership are checked using the procedure described in security checks.
A string containing allowed field delimiters.
The value of the lookup key. Before using, it is expanded as described in patterns.
Number of the key field in file. Fields are numbered starting from 1.
Number of the value field.
If supplied, this value is used as a replacement value, when the key was not found in file.
The map file consists of records, separated by newline characters (in other words, a record occupies one line). Each record consists of fields, separated by delimiters, given in delim argument. If delim contains a space character, then fields may be delimited by any amount of whitespace characters (spaces and/or tabulations). Otherwise, exactly one delimiter delimits fields.
Fields are numbered starting from 1.
The map
action works as follows:
For example, suppose that the file /etc/passwd.rush has the same syntax as the system passwd file (see Password File in passwd(5) man page). Then, the following statement will replace ‘argv[0]’ with the value of ‘shell’ field, using the current user name as a key:
map[0] /etc/passwd.rush : ${user} 1 7
See also Interactive, for another example of using this statement.
This document was generated on June 29, 2019 using makeinfo.
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.