sh-posix.1 (2010 09)
s
sh-posix(1) sh-posix(1)
NAME
sh-posix: sh, rsh - standard and restricted POSIX.2-conformant command shells
SYNOPSIS
sh [±aefhikmnprstuvx
][±o option ]... [
-c string ][arg]...
rsh [±aefhikmnprstuvx
][±o option ]... [
-c string ][arg]...
Remarks
This shell is intended to conform to the shell specification of the POSIX.2 Shell and Utility standards.
Check any standards conformance documents shipped with your system for information on the confor-
mance of this shell to any other standards.
List of Subheadings in DESCRIPTION
Shell Invocation Tilde Substitution Environment
Options Command Substitution Functions
rsh Restrictions Parameter Substitution Jobs
Definitions Blank Interpretation Signals
Commands File Name Generation Execution
Simple Commands Quoting Command Reentry
Compound Commands Arithmetic Evaluation Command Line Editing
Special Commands Prompting emacs/gmacs Editing Mode
Comments Conditional Expressions vi Editing Mode
Aliasing Input/Output
DESCRIPTION
sh is a command programming language that executes commands read from a terminal or a file.
rsh is a restricted version of sh. See the rsh Restrictions subsection below.
Shell Invocation
If the shell is invoked by an
exec*() system call and the first character of argument zero (shell parame-
ter 0) is dash (-), the shell is assumed to be a login shell and commands are read first from
/etc/profile, then from either .profile in the current directory or $HOME/.profile
if either
file exists, and finally from the file named by performing parameter substitution on the value of the
environment parameter
ENV, if the file exists. If the -s option is not present and an arg is, a path search
is performed on the first arg to determine the name of the script to execute. When running
sh with arg,
the script arg must have read permission and any
setuid and setgid settings will be ignored. Com-
mands are read as described below.
Shell output, except for the output of some of the commands listed in the Special Commands subsection,
is written to standard error (file descriptor 2).
Options
The following options are interpreted by the shell when it is invoked.
-c string Read commands from string .
-i If -i is present or if the shell input and output are attached to a terminal (as reported by
tty()), the shell is interactive. In this case SIGTERM is ignored and SIGINT is caught and
ignored (so that wait is interruptible). In all cases, SIGQUIT is ignored by the shell. See
signal (5).
-r The shell is a restricted shell.
-s If -s is present or if no arguments remain, commands are read from the standard input.
The remaining options and operands are described under the
set command in the Special Commands
subsection.
rsh Restrictions
rsh is used to set up login names and execution environments where capabilities are more controlled
than those of the standard shell. The actions of rsh are identical to those of sh, except that the following
are forbidden:
• Changing directory (see the
cd special command and cd(1))
HP-UX 11i Version 3: September 2010 − 1 − Hewlett-Packard Company 1