HP-UX Reference (11i v2 07/12) - 1 User Commands N-Z (vol 2)

s
sh-posix(1) sh-posix(1)
PS1 The value of this parameter is expanded for parameter substitution, to define the primary
prompt string. The default value is "$
". The character ! in the primary prompt string is
replaced by the command number. See the Command Reentry subsection.
PS2 Secondary prompt string for command completion. The default value is "
> ".
PS3 Selection prompt string used within a
select loop. If unset, it defaults to "#? ".
PS4 Execution trace string that precedes each line of an execution trace. See the
set -x spe-
cial command. If unset, it defaults to "
+ ".
SHELL The path name of the shell is kept in the environment. When invoked, the shell is res-
tricted if the value of this variable contains an
r in the base name.
TMOUT If set to a value greater than zero, the shell will terminate if a command is not entered
within the prescribed number of seconds after issuing the
PS1 prompt. (Note that the shell
can be compiled with a maximum bound for this value which cannot be exceeded.)
VISUAL Invokes the corresponding option when the value of this variable ends in
emacs, gmacs,
or
vi. See the set -o
special command.
The shell gives default values to
IFS, MAILCHECK, PATH, PS1, PS2, and
TMOUT. On the other hand,
MAIL, ENV, HOME, and SHELL are never set automatically by the shell (although
HOME, MAIL, and
SHELL are set by login; see login(1)).
Blank Interpretation
After parameter and command substitution, the results of substitution are scanned for field separator char-
acters (defined in IFS), and split into distinct arguments when such characters are found.
sh retains
explicit null arguments (
"" or ’’) but removes implicit null arguments (those resulting from parameters
that have null values).
File Name Generation
Following substitution, each command word is processed as a pattern for file name expansion unless expan-
sion has been disabled with the
set -f special command. The form of the patterns is the Pattern Match-
ing Notation defined in regexp(5). The word is replaced with sorted file names matching the pattern. If no
file name is found that matches the pattern, the word is left unchanged.
In addition to the notation described in regexp(5),
sh recognizes composite patterns made up of one or
more patterns separated from each other with a |. Composite patterns can be formed with one or more of
the following:
?(pattern-list) Matches any one of the given patterns.
*(pattern-list) Matches zero or more occurrences of the given patterns.
+(pattern-list) Matches one or more occurrences of the given patterns.
@(pattern-list) Matches exactly one of the given patterns.
!(pattern-list) Matches anything, except one of the given patterns.
Quoting
Each of the metacharacters (see the Definitions subsection) has a special meaning to the shell and ter-
minates a word unless quoted. A character may be quoted (that is, made to stand for itself) by preceding
it with a backslash (
\). The pair \newline is ignored; the current and following lines are concatenated.
All characters enclosed between a pair of apostrophes (...) are quoted. An apostrophe cannot appear
within apostrophes.
Parameter and command substitution occurs inside quotation marks ("..."). \ quotes the characters \, ,
", and $.
Inside grave accent marks (...), \ quotes the characters \, , and $. If the grave accents occur within
quotation marks, \ also quotes the character ".
The meanings of $* and $@ are identical when not quoted or when used as a parameter assignment value
or as a file name. However, when used as a command argument, "$*" is equivalent to "$1d$2d...",
whereas "$@" is equivalent to "$1"d"$2"d... (where d is the first character of IFS),
The special meaning of keywords or aliases can be removed by quoting any character of the name. The
recognition of function names or special command names cannot be altered by quoting them.
280 Hewlett-Packard Company 16 HP-UX 11i Version 2: December 2007 Update