MPE/iX Shell and Utilities Reference Manual, Vol 2
sh(1) MPE/iX Shell and Utilities sh(1)
If you invoke the shell with a name that begins with the – character, it is a login shell.(You
can also get a login shell if you invoke the shell with the –L option.) A login shell begins by
executing the file
/etc/profile
It then executes
$HOME
/.profile
using the . command (see dot(1)). If
$HOME
is not set, the shell searches the current direc-
tory for
.profile
and executes this file with the . command if it exists. The shell does not complain if any of
these files cannot be found.
You can use these profile files to customize your session with sh. For example, your profile
files can set options, create aliases, or define functions and variables.
If there is at least one argument on the sh command line, sh takes the first argument as the
name of a shell script to execute. (The exception to this is when –s is used.) Any additional
arguments are assigned to the positional parameters; usually, these serve as arguments to the
shell script. See Parameter Substitution for information about positional parameters, and see
set(1) for information about changing these parameters.
If sh finds the
ENV
environment variable set when it begins execution (after profile process-
ing), sh executes the file named by the expansion of the value of this variable (see Variables).
The shell accepts the following options on the command line:
–c cmdstring
executes cmdstring as if it were an input line to the shell and then exits. This is used
by programs (for example, editors) that call the shell for a single command. sh
assigns arguments after cmdstring to the positional parameters. If you specify
cmd_name, special parameter 0 is set to this string for use when executing the com-
mands in cmdstring.
–i invokes an interactive shell, as opposed to running a script. With –i, the shell
catches and ignores interrupts. Without –i, an interrupt terminates the shell. For
shells which read from the terminal, –i is the default.
–K specifies Korn-compatible behavior in any case where the
POSIX.2 behavior is differ-
ent from the behavior specified by Korn. Without –K, the shell defaults to POSIX.2
behavior.
1-520 Commands and Utilities