bsh Command
Purpose
The bsh command invokes the Bourne shell.
Syntax
bsh [ -i ] [ -r ] [ { + | - } { [ a ] [ e ] [ f ] [ h ] [ k ] [ n ] [ t ] [ 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 bsh command invokes the Bourne shell, an interactive command interpreter and command-programming language. The shell carries out commands either interactively from a terminal keyboard or from a file.
Flags
The Bourne shell interprets the following flags only when the shell is invoked 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 has 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 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 called within functions as the functions are defined. (Normally these commands are located when the function is executed; see the hashcommand.) |
-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 execute them. The -n flag can be used to check for shell-script syntax errors. An interactive shell may ignore this option. |
-r | Invokes the restricted shell. Using this flag is the same as issuing the Rsh command, except the shell enforces restrictions when reading the .profile files. |
-s | Reads commands from standard input. Any remaining parameters 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 | Exits after reading and executing one command. |
-u | Treats an unset variable as an error and immediately exits when performing 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 executed. |
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. |