[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 1


bsh Command

Purpose

The bsh command invokes the Bourne shell.

Syntax

bsh-i ] [  -r ] [ { -  } {  [  a  ] [  e  ] [  f  ] [  ] [   k  ] [  n  ] [  t  ] [  u  ] [  ] [   ] } ] [  -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.

For more information about the Bourne shell, see "Bourne Shell" in AIX 5L Version 5.1 System User's Guide: Operating System and Devices.

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. See the discussion of positional parameters in "Variable Substitution in the Bourne Shell" in AIX 5L Version 5.1 System User's Guide: Operating System and Devices for more information.

-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:
  • It exits with a return value greater than 0.
  • It is not part of the compound list of a while, until, or if command.
  • It is not being tested using AND or OR lists.
  • It is not a pipeline preceded by the ! (exclamation point) reserved word.
-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 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 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


/usr/bin/sh Specifies a default path name to the shell. This file is a link to the Bourne shell.
/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.

Related Information

The env command, sh command, Rsh command.

The /etc/passwd file, null special file, environment file.

The profile file format.

Bourne Shell in AIX 5L Version 5.1 System User's Guide: Operating System and Devices.

Bourne Shell Special Commands in AIX 5L Version 5.1 System User's Guide: Operating System and Devices.

Variable Substitution in the Bourne Shell in AIX 5L Version 5.1 System User's Guide: Operating System and Devices.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]