MPE/iX Shell and Utilities Reference Manual, Vol 2
sh(1) MPE/iX Shell and Utilities sh(1)
Variables
The shell maintains variables and can expand them where they are used in command lines; see
Parameter Substitution for details.
A variable name must begin with an uppercase or lowercase letter or the underscore (_). Sub-
sequent characters in the name, if any, may be upper or lowercase letters, underscores, and/or
digits 0 through 9. You can assign a value to a variable with
variable=value
You may implicitly declare a variable as an array by using a subscript expression when
assigning a value, as in
variable[arithmetic expression]=value
You can use a subscripted array variable anywhere that the shell allows an ordinary variable.
See the section on Arithmetic Substitution for the syntax of an arithmetic expression. Also see
typeset(1), export(1), and readonly(1) for details about the attributes of shell vari-
ables, and how shell variables may be exported to child processes.
For a list of variables that the shell either sets or understands, see ENVIRONMENT
VARIABLES.
Shell Execution Environments
A shell execution environment is the set of conditions affecting most commands executed
within the shell. It consists of:
• open files
• the current working directory (see cd(1))
• the file creation mask (see umask(1))
• the traps currently set (see trap(1))
• the shell parameters (see set(1) and export(1))
• the shell functions currently defined (see Command Execution)
• options (see set(1))
A subshell environment starts as a duplicate of the shell environment, except that traps caught
by the shell are set to default values in the subshell. Since the subshell environment starts as a
duplicate, the value of the
ENV
environment variable is not run. Changes made to a subshell
environment do not affect the shell environment.
Command substitutions, commands within parentheses (that is, (command)), and commands
to be run asynchronously (that is, command&) all run in subshell environments. Each com-
mand in a pipeline command|command runs in a subshell environment.
Shell utilities also run in a separate environment which does not affect the shell environment,
except for certain built-in utilities (for example, cd and umask) which explicitly alter the
Commands and Utilities 1-539