Rsh command
Purpose
Starts the restricted version of the Bourne shell.
Syntax
Rsh [-i] [ { + | - }{ [-a] [-e] [-f] [-h] [-k] [-n] [-t timeout] [-u] [-v] [-x] } ] [-c String | -s | File [Parameter] ]Note: Preceding a flag with a + (plus sign)
rather than a - (minus sign) turns it off.
Description
The Rsh command starts a restricted version of the Bourne shell, which is useful for installations that require a more controlled shell environment. You can create user environments with a limited set of privileges and capabilities.
Flags
The Bourne shell interprets the following flags only when the shell is started at the command line.
Note: Unless
you specify either the -c or -s flag,
the shell assumes that the next parameter is a command file (shell
script). It passes anything else on the command line to that command
file.
Item | Description |
---|---|
-a | Marks for export all variables to which an assignment is performed. If the assignment precedes a command name, the export attribute is effective only for that command's execution environment, except when the assignment precedes one of the special built-in commands. In this case, the export attribute persists after the built-in command is completed. If the assignment does not precede a command name, or if the assignment is a result of the operation of the getopts or read command, the export attribute persists until the variable is unset. |
-c String | Runs commands that are read from the String variable. Sets the value of special parameter 0 from the value of the String variable and the positional parameters ($1, $2, and so on) in sequence from the remaining parameter operands. The shell does not read additional commands from standard input when you specify this flag. |
-e | Exits immediately if all of the following
conditions exist for a command:
|
-f | Disables file name substitution. |
-h | Locates and remembers the commands that are called within functions as the functions are defined. (Usually these commands are located when the function is run; see the hash command.) |
-i | Makes the shell interactive, even if input and output are not from a workstation. In this case, the shell ignores the TERMINATE signal, so that the kill 0 command does not stop an interactive shell, and traps an INTERRUPT signal, so you can interrupt the function of the wait command. In all cases, the shell ignores the QUIT signal. |
-k | Places all keyword parameters in the environment for a command, not just those preceding the command name. |
-n | Reads commands but does not run them. The -n flag can be used to check for shell-script syntax errors. An interactive shell might ignore this option. |
-s | Reads commands from standard input. Any remaining parameters that are specified are passed as positional parameters to the new shell. Shell output is written to standard error, except for the output of built-in commands. |
-t timeout | Exits after the timeout seconds if there is no reply from the server. |
-u | Treats an unset variable as an error and immediately exits when it performs variable substitution. An interactive shell does not exit. |
-v | Displays shell input lines as they are read. |
-x | Displays commands and their arguments before they are run. |
Note: Using a + (plus sign) rather than
a - (minus sign) unsets flags. The $- special
variable contains the current set of flags.
Files
Item | Description |
---|---|
/usr/bin/bsh | Specifies the path name to the Bourne shell. |
/usr/bin/Rsh | Specifies the path name to the restricted Bourne shell, a subset of the Bourne shell. |
/tmp/sh* | Contains temporary files that are created when a shell is opened. |