GNU Rush - News
Version 1.6 released.
Item posted by Sergey Poznyakoff <gray> on Tue 10 Feb 2009 02:53:14 PM UTC.
GNU Rush version 1.6 is available for download from ftp://ftp.gnu.org/gnu/rush and ftp://download.gnu.org.ua/pub/release/rush.
Following is a list of user-visible changes:
Patterns in _transform_ statement
The syntax of the transform statement has been extended to
allow for specifying transformation argument string:
transform STRING REGEX
or
transform[N] STRING REGEX
STRING may contain meta-variables, which are expanded before
performing the transformation. The following meta-variables are
defined:
${user} User name
${group} Name of the user's principal group
${uid} UID
${gid} GID
${home} User's home directory
${gecos} User's GECOS field
${program} Program name
${command} Full command line
$0 to $9 The value of the Nth command line argument
${N} Same as above, useful if N > 9 or N < 0 (see "Negative argument indexes", below).
Thus, for example:
transform[0] s,.*/,/bin/,
is equivalent to:
transform[0] $0 s,.*/,/bin/,
The _map_ statement
This statement sets a command line argument using a map file.
map[N] FILE DELIM KEY K V [DEFAULT]
Each line in a map file FILE contains fields, separated by delimiter DELIM. The map statement looks for the record whose Kth field has the value of KEY. If such a record is found, its Vth field becomes a new value of the Nth command line argument. Othervise, if DEFAULT is given, it is used as a new value. Otherwise, the argument retains its old value.
KEY may contain meta-variables described above (see "Patterns in
transform statement").
The _set_ statement
The set statement replaces entire command line with the new value:
rule foo
set /bin/scp -t /upload
In indexed form, it replaces the given argument:
set[0] /bin/scp
The argument to `set' may contain meta-variables (see "Patterns in transform statement").
The _delete_ statement
This statement deletes the given argument, or range of arguments, from the command line. It has two forms:
1. Delete the Nth argument:
delete[N]
2. Delete all arguments between indexes N and M, inclusive:
delete N M
Modifying program name
To modify the program name (as opposed to argv[0]), use ^ pseudo-index, e.g.:
set[^] /bin/scp
By default (unless [^] form is used) argv[0] is used as the program name.
Negative argument indexes
Negative argument indexes refer to arguments numbered from the end of the command line. E.g.:
transform[-1] is the same as transform[$]
transform[-2] will transform the last but one argument
New statement _interactive_
This statement provides a replacement command line for interactive use of rush. By default, such use is prohibited. However, using the interactive statement you can allow some users a limited interactive access. For example:
interactive shell-command
rule login
command shell-command
group rshell
map[^] /usr/local/etc/rush.shell : ${user} 1 2 none
transform[0] ${program} s,^.*/,-r,
Use of predefined error messages in _exit_ statement
Predefined error messages can be used in `exit' statements.
E.g., the statement:
exit @nologin-message
will retrieve the text of the `nologin-message' and send it to the remote party before exiting.
If the message text must begin with a `@' sign, duplicate it:
exit @@special error message
Powered by Savane 3.14-8aba.
Corresponding source code