477 lines
18 KiB
HTML
477 lines
18 KiB
HTML
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
||
|
<meta http-equiv="Content-Type" content=
|
||
|
"text/html; charset=utf-8">
|
||
|
<title>Variables</title>
|
||
|
<LINK rel="stylesheet" type="text/css" href="../rzahg/ic.css">
|
||
|
</HEAD>
|
||
|
<body bgcolor="#FFFFFF">
|
||
|
<!-- Java sync-link -->
|
||
|
<SCRIPT LANGUAGE="Javascript" SRC="../rzahg/synch.js" TYPE="text/javascript"></SCRIPT>
|
||
|
|
||
|
|
||
|
|
||
|
<h2>Variables</h2>
|
||
|
|
||
|
<p>When it is started, <strong>qsh</strong> initializes shell
|
||
|
variables from the defined environment variables. A variable is
|
||
|
used to store data. You can change the value of an existing
|
||
|
variable or create a new variable by using one of these
|
||
|
methods:</p>
|
||
|
|
||
|
<ul>
|
||
|
<li>Assigning a variable using name=value.</li>
|
||
|
|
||
|
<li>Calling the <a href="read.htm">read</a> or <a href="getopts.htm">
|
||
|
getopts</a> utilities.</li>
|
||
|
|
||
|
<li>Using the <em>name</em> parameter in a <strong>for</strong>
|
||
|
loop or <strong>select</strong> conditional construct.</li>
|
||
|
|
||
|
<li>Using the ${name=value} parameter expansion.</li>
|
||
|
|
||
|
<li>Calling the <a href="declare.htm">declare</a> or
|
||
|
<a href="typeset.htm">typeset</a> utilities.</li>
|
||
|
</ul>
|
||
|
|
||
|
<p>Variable names can contain alphabetic characters, numeric
|
||
|
characters, or the underscore (<strong>_</strong>). A variable name
|
||
|
cannot begin with a numeric character.</p>
|
||
|
|
||
|
<h3>Variables set by qsh</h3>
|
||
|
|
||
|
<dl>
|
||
|
<dt><strong>_ (Temporary variable)</strong></dt>
|
||
|
|
||
|
<dd>This variable is set by <strong>qsh</strong> to the last
|
||
|
argument of the previous simple command.</dd>
|
||
|
|
||
|
<dt>
|
||
|
<strong>EGID (Effective primary group identifer)</strong></dt>
|
||
|
|
||
|
<dd>This variable set by <strong>qsh</strong> to the effective primary
|
||
|
group identifier of the process at the time <strong>qsh</strong> is started.
|
||
|
This variable is read-only.</dd>
|
||
|
|
||
|
<dt>
|
||
|
<strong>EUID (Effective user identifer)</strong></dt>
|
||
|
|
||
|
<dd>This variable set by <strong>qsh</strong> to the effective user
|
||
|
identifier of the process at the time <strong>qsh</strong> is started.
|
||
|
This variable is read-only.</dd>
|
||
|
|
||
|
<dt>
|
||
|
<strong>GID (Primary group identifer)</strong></dt>
|
||
|
|
||
|
<dd>This variable set by <strong>qsh</strong> to the primary
|
||
|
group identifier of the process at the time <strong>qsh</strong> is started.
|
||
|
This variable is read-only.</dd>
|
||
|
|
||
|
<dt>
|
||
|
<strong>HOSTID (IP identifier of host)</strong></dt>
|
||
|
|
||
|
<dd>This variable set by <strong>qsh</strong> to the IP address of
|
||
|
the host system.</dd>
|
||
|
|
||
|
<dt>
|
||
|
<strong>HOSTNAME (Name of host)</strong></dt>
|
||
|
|
||
|
<dd>This variable set by <strong>qsh</strong> to the name of
|
||
|
the host system.</dd>
|
||
|
|
||
|
<dt>
|
||
|
<strong>HOSTTYPE (Type of host)</strong></dt>
|
||
|
|
||
|
<dd>This variable set by <strong>qsh</strong> to a string that represents
|
||
|
the type of the host system. The value is set to "powerpc".
|
||
|
</dd>
|
||
|
|
||
|
<dt><strong>JOBNAME (Qualified job name)</strong></dt>
|
||
|
|
||
|
<dd>This variable is set by <strong>qsh</strong> to the qualified
|
||
|
job name of the current job. The qualified job name is used by CL
|
||
|
commands to identify a job.</dd>
|
||
|
|
||
|
<dt>
|
||
|
<strong>LAST_JOBNAME (Qualified job name of last job)</strong></dt>
|
||
|
|
||
|
<dd>This variable is set by <strong>qsh</strong> to the qualified
|
||
|
job name of the last job it started. The qualified job name is used by CL
|
||
|
commands to identify a job.</dd>
|
||
|
|
||
|
<dt><strong>LINENO (Line number)</strong></dt>
|
||
|
|
||
|
<dd>This variable is set by <strong>qsh</strong> to the current
|
||
|
line number (decimal) in a script or function before it runs each
|
||
|
command.</dd>
|
||
|
|
||
|
<dt>
|
||
|
<strong>MACHTYPE (Machine type)</strong></dt>
|
||
|
|
||
|
<dd>This variable is set by <strong>qsh</strong> to a string that represents the
|
||
|
machine type. The value is set to "powerpc-ibm-os400".
|
||
|
</dd>
|
||
|
|
||
|
<dt><strong>OLDPWD (Previous working directory)</strong></dt>
|
||
|
|
||
|
<dd>This variable is set by <a href="cd.htm">cd</a> to the previous
|
||
|
working directory after the current working directory is
|
||
|
changed.</dd>
|
||
|
|
||
|
<dt><strong>OPTARG (Option argument)</strong></dt>
|
||
|
|
||
|
<dd>This variable is set by <a href="getopts.htm">getopts</a> when
|
||
|
it finds an option that requires an argument.</dd>
|
||
|
|
||
|
<dt><strong>OPTIND (Option index)</strong></dt>
|
||
|
|
||
|
<dd>This variable is set by <a href="getopts.htm">getopts</a> to
|
||
|
the index of the argument to look at for the next option. The
|
||
|
variable is set to one when <strong>qsh</strong>, a script, or a
|
||
|
function is invoked.</dd>
|
||
|
|
||
|
<dt>
|
||
|
<strong>OSTYPE (Operating system type)</strong></dt>
|
||
|
|
||
|
<dd>This variable set by <strong>qsh</strong> to a string that represents the
|
||
|
operating system type. The value is set to "os400".
|
||
|
</dd>
|
||
|
|
||
|
<dt><strong>PPID (Parent process ID)</strong></dt>
|
||
|
|
||
|
<dd>This variable is set by <strong>qsh</strong> to the decimal
|
||
|
process ID of the process that invoked the current shell. In a
|
||
|
subshell, the value of the variable is not changed even if the
|
||
|
subshell is running in a different process.</dd>
|
||
|
|
||
|
<dt><strong>PWD (Working directory)</strong></dt>
|
||
|
|
||
|
<dd>This variable is set by <a href="cd.htm">cd</a> to the current
|
||
|
working directory after it is changed.</dd>
|
||
|
|
||
|
<dt><strong>QSH_VERSION (Current version)</strong></dt>
|
||
|
|
||
|
<dd>This variable is set by <strong>qsh</strong> to a string that
|
||
|
represents the current version. The string is in the form VxRyMz
|
||
|
where x is the version number, y is the release number, and z is
|
||
|
the modification number. This variable is read-only.</dd>
|
||
|
|
||
|
<dt><strong>RANDOM (Random number generator)</strong></dt>
|
||
|
|
||
|
<dd>This variable is set by <strong>qsh</strong> to an integer
|
||
|
random number between 1 and 32767 each time it is referenced. You
|
||
|
can seed the random number generator by setting the variable.</dd>
|
||
|
|
||
|
<dt><strong>REPLY (Reply variable)</strong></dt>
|
||
|
|
||
|
<dd>This variable is set by <a href="read.htm">read</a> to the
|
||
|
characters that are read when you do not specify any
|
||
|
arguments and by the select compound command to the contents
|
||
|
of the input line read from standard input.</dd>
|
||
|
|
||
|
<dt><strong>TERMINAL_TYPE (Type of terminal)</strong></dt>
|
||
|
|
||
|
<dd>This variable is set by <strong>qsh</strong> to the type of
|
||
|
terminal attached to the standard file descriptors. The value is
|
||
|
set to "5250" when attached to a 5250 display, to "REMOTE" when
|
||
|
attached to a remote client, or to "PIPELINE" when attached to
|
||
|
pipes.</dd>
|
||
|
|
||
|
<dt><strong>UID (User identifer)</strong></dt>
|
||
|
|
||
|
<dd>This variable set by <strong>qsh</strong> to the user
|
||
|
identifier of the process at the time <strong>qsh</strong> is started.
|
||
|
This variable is read-only.</dd>
|
||
|
|
||
|
</dl>
|
||
|
|
||
|
<h3>Variables used by qsh</h3>
|
||
|
|
||
|
<dl>
|
||
|
<dt><strong>CDPATH (Search path for cd)</strong></dt>
|
||
|
|
||
|
<dd>If the directory you specify for <a href="cd.htm">cd</a> does
|
||
|
not begin with a slash (/), <strong>qsh</strong> searches the
|
||
|
directories listed in <strong>CDPATH</strong> in order for the
|
||
|
specified directory. The value of the variable is a colon separated
|
||
|
list of directories. The current working directory is specified by
|
||
|
a period (.) or a null directory before the first colon, between
|
||
|
two colons, or after the last colon. There is no default
|
||
|
value.</dd>
|
||
|
|
||
|
<dt><strong>ENV (Environment file)</strong></dt>
|
||
|
|
||
|
<dd>When <strong>qsh</strong> is invoked, it performs parameter
|
||
|
expansion, command substitution, and arithmetic expansion on this
|
||
|
variable to generate the path name of a shell script to run in the
|
||
|
current environment. It is typically used to set aliases, define
|
||
|
functions, or set options. There is no default value.</dd>
|
||
|
|
||
|
<dt><strong>HOME (Home directory)</strong></dt>
|
||
|
|
||
|
<dd>The value of this variable is the path name of your home
|
||
|
directory. The value is used for tilde expansion and as the default
|
||
|
argument for <a href="cd.htm">cd</a>. The value is set by default
|
||
|
to the value specified in your user profile.</dd>
|
||
|
|
||
|
<dt><strong>IFS (Internal field separators)</strong></dt>
|
||
|
|
||
|
<dd>The value is a string treated as a list of characters that is
|
||
|
used for field splitting and to split lines into fields with <a
|
||
|
href="read.htm">read</a>. The first character of the value is used
|
||
|
to separate arguments when expanding the <strong>*</strong> special
|
||
|
parameter. The default value is
|
||
|
"<space><tab><newline>".</dd>
|
||
|
|
||
|
<dt><strong>LANG (Language locale)</strong></dt>
|
||
|
|
||
|
<dd>This variable defines the locale category used for categories
|
||
|
that are not specifically set with a variable starting with
|
||
|
<strong>LC_</strong>. There is no default value.</dd>
|
||
|
|
||
|
<dt><strong>LC_ALL (Locale settings)</strong></dt>
|
||
|
|
||
|
<dd>This variable overrides the value of any variables starting
|
||
|
with <strong>LC_.</strong> There is no default value.</dd>
|
||
|
|
||
|
<dt><strong>LC_COLLATE (Locale collation)</strong></dt>
|
||
|
|
||
|
<dd>This variable defines the collation relations between
|
||
|
characters. There is no default value.</dd>
|
||
|
|
||
|
<dt><strong>LC_CTYPE (Locale character classes)</strong></dt>
|
||
|
|
||
|
<dd>This variable defines character types such as upper-case,
|
||
|
lower-case, space, digit and, punctuation. There is no default
|
||
|
value.</dd>
|
||
|
|
||
|
<dt><strong>LC_MESSAGES (Locale message formatting)</strong></dt>
|
||
|
|
||
|
<dd>This variable defines the format and values for affirmative and
|
||
|
negative responses from applications. There is no default
|
||
|
value.</dd>
|
||
|
|
||
|
<dt><strong>LC_MONETARY (Locale monetary formatting)</strong></dt>
|
||
|
|
||
|
<dd>This variable defines the monetary names, symbols, and other
|
||
|
details. There is no default value.</dd>
|
||
|
|
||
|
<dt><strong>LC_NUMERIC (Locale numeric formatting)</strong></dt>
|
||
|
|
||
|
<dd>This variable defines the decimal point character for formatted
|
||
|
input/output and string conversion functions. There is no default
|
||
|
value.</dd>
|
||
|
|
||
|
<dt><strong>LC_TIME (Locale time formatting)</strong></dt>
|
||
|
|
||
|
<dd>This variable defines the date and time conventions, such as
|
||
|
calendar used, time zone, and days of the week. There is no default
|
||
|
value.</dd>
|
||
|
|
||
|
<dt><strong>LC_TOD (Locale time zone)</strong></dt>
|
||
|
|
||
|
<dd>This variable defines the time zone name, time zone difference,
|
||
|
and Daylight Savings Time start and end. There is no default
|
||
|
value.</dd>
|
||
|
|
||
|
<dt><strong>NLSPATH (Search path for message catalogs)</strong></dt>
|
||
|
|
||
|
<dd>When opening a message catalog, the system searches the
|
||
|
directories listed in the order specified until it finds the
|
||
|
catalog. The value of the variable is a colon separated list of
|
||
|
directories. There is no default value.</dd>
|
||
|
|
||
|
<dt><strong>PATH (Search path for commands)</strong></dt>
|
||
|
|
||
|
<dd>If the command you specify does not begin with a slash (/),
|
||
|
<strong>qsh</strong> searches the directories listed in the order
|
||
|
specified until it finds the command to run. The value of the
|
||
|
variable is a colon separated list of directories. The current
|
||
|
working directory is specified by a period (.) or a null directory
|
||
|
before the first colon, between two colons, or after the last
|
||
|
colon. The default value is "/usr/bin:".</dd>
|
||
|
|
||
|
<dt><strong>PS1 (Primary prompt string)</strong></dt>
|
||
|
|
||
|
<dd>When the interactive option is set, <strong>qsh</strong>
|
||
|
performs parameter expansion, command substitution, and arithmetic
|
||
|
expansion on the variable and displays it on stderr when <strong>
|
||
|
qsh</strong> is ready to read a command. The default value is
|
||
|
"$".</dd>
|
||
|
|
||
|
<dt><strong>PS2 (Secondary prompt string)</strong></dt>
|
||
|
|
||
|
<dd>When you enter <newline> before completing a command
|
||
|
<strong>qsh</strong> displays the value of this variable on stderr.
|
||
|
The default value is ">".</dd>
|
||
|
|
||
|
<dt>
|
||
|
<strong>PS3 (Select command prompt)</strong></dt>
|
||
|
|
||
|
<dd>When the <strong>select</strong> compound command is run, <strong>qsh</strong>
|
||
|
performs parameter expansion, command substitution, and arithmetic expansion
|
||
|
on the variable and displays it on stderr to prompt the user to select
|
||
|
one of the choices displayed by <strong>select</strong>. The default value is
|
||
|
"#?".</dd>
|
||
|
|
||
|
<dt><strong>PS4 (Debug prompt string)</strong></dt>
|
||
|
|
||
|
<dd>When the execution trace option is set and the interactive
|
||
|
option is set, <strong>qsh</strong> performs parameter expansion,
|
||
|
command substitution, and arithmetic expansion on the variable and
|
||
|
displays it on stderr before each line in the execution trace. The
|
||
|
default value is "+".</dd>
|
||
|
|
||
|
<dt>
|
||
|
<strong>QIBM_CCSID (CCSID for translation)</strong></dt>
|
||
|
|
||
|
<dd>When this variable is set to a numeric value, <strong>
|
||
|
qsh</strong> and various utilities use the value for creating files
|
||
|
and translating data from the CCSID of the job. The default value is "0"
|
||
|
for the default job CCSID. A value of "65535" means no translation is done.
|
||
|
</dd>
|
||
|
|
||
|
<dt><strong>QIBM_CHILD_JOB_SNDINQMSG (Send inquiry message when
|
||
|
child process starts)</strong></dt>
|
||
|
|
||
|
<dd>When this variable is set to a positive numeric value, the
|
||
|
parent process is sent an inquiry message with the qualified job
|
||
|
name of the child process. The child process is held until you
|
||
|
reply the message. By setting this variable, you can debug the
|
||
|
program running in the child process by setting breakpoints before
|
||
|
the program runs. The value of the variable is the level of
|
||
|
descendant processes to debug. When set to 1, child processes are
|
||
|
held, when set to 2 child and grandchild processes are held, etc.
|
||
|
There is no default value.</dd>
|
||
|
|
||
|
<dt><strong>QIBM_MULTI_THREADED (Start multi-thread capable
|
||
|
processes)</strong></dt>
|
||
|
|
||
|
<dd>This variable determines if processes started by <strong>
|
||
|
qsh</strong> can create multiple threads. When the value of the
|
||
|
variable is "Y", all child processes started by <strong>qsh</strong>
|
||
|
can start threads. The default value is "N". </dd>
|
||
|
|
||
|
<dt><strong>QSH_REDIRECTION_TEXTDATA (Process data as text for file
|
||
|
redirection)</strong></dt>
|
||
|
|
||
|
<dd>This variable determines if data read from or written to a file
|
||
|
specified on a <a href="redirect.htm">redirection</a> is treated as
|
||
|
text data or binary data. When the value of the variable is "Y",
|
||
|
<strong>qsh</strong> treats the data read from or written to the
|
||
|
file as text data. When the value of the variable is not "Y",
|
||
|
<strong>qsh</strong> treats the data read from or written to the
|
||
|
file as binary data. The default value is "Y".</dd>
|
||
|
|
||
|
<dt><strong>QSH_USE_PRESTART_JOBS (Use pre-start jobs when
|
||
|
available)</strong></dt>
|
||
|
|
||
|
<dd>This variable determines if processes started by <strong>
|
||
|
qsh</strong> use prestart jobs when available. When the value of
|
||
|
the variable is "Y", <strong>qsh</strong> uses prestart jobs if they
|
||
|
are available in the current subsystem. When the value of the
|
||
|
variable is not "Y", or prestart jobs are not available, the
|
||
|
processes started by <strong>qsh</strong> are batch immediate jobs.
|
||
|
The default value is "Y".</dd>
|
||
|
|
||
|
<dt><strong>SHELL (Path name of the shell)</strong></dt>
|
||
|
|
||
|
<dd>When running a script file that does not contain "#!" on the first line,
|
||
|
<strong>qsh</strong> uses the value of this variable as the path name of
|
||
|
the shell interpreter to run the script. There is no default
|
||
|
value.</dd>
|
||
|
|
||
|
<dt><strong>TRACEFILE (Path name of trace file)</strong></dt>
|
||
|
|
||
|
<dd>When the trace option is set, <strong>qsh</strong> uses the
|
||
|
value of this variable as the path name of the file to store the
|
||
|
trace information. The default value is "$HOME/qsh_trace".</dd>
|
||
|
|
||
|
<dt>
|
||
|
<strong>TRACEOPT (Options for trace file)</strong></dt>
|
||
|
|
||
|
<dd>When the trace option is set, <strong>qsh</strong> uses the
|
||
|
value of this variable to determine how to handle the trace file.
|
||
|
When the value of the variable is "UNLINK", <strong>qsh</strong>
|
||
|
unlinks the trace file before opening it in a root shell.
|
||
|
When the value of the variable is "KEEP", <strong>qsh</strong>
|
||
|
keeps the current trace file. The default value is
|
||
|
"UNLINK".</dd>
|
||
|
</dl>
|
||
|
|
||
|
<h3>Other variables</h3>
|
||
|
|
||
|
<dl>
|
||
|
<dt><img src="delta.gif" alt="Start of change"><strong>QIBM_CMP_FILE_SIZE</strong></dt>
|
||
|
|
||
|
<dd>This variable controls the maximum file size in bytes that <strong>cmp</strong> reads
|
||
|
into an internal buffer for better performance. For files larger than the
|
||
|
maximum size, <strong>cmp</strong> reads the files one byte at a time.
|
||
|
<img src="deltaend.gif" alt="End of change"></dd>
|
||
|
|
||
|
<dt>
|
||
|
<strong>QIBM_OD_OUTPUT_FORMAT (Output format for od)</strong></dt>
|
||
|
|
||
|
<dd>This variable controls the output format for the <a href="od.htm">od</a>
|
||
|
utility. If the value is "OLD", <strong>od</strong> uses the old
|
||
|
format from previous releases. The old format is not compatible with the current
|
||
|
industry standard and its use is discouraged. There is no default value.
|
||
|
</dd>
|
||
|
|
||
|
<dt><strong>QIBM_QSH_CMD_ESCAPE_MSG (Send escape messages from QSH CL command)</strong></dt>
|
||
|
|
||
|
<dd>This variable controls how messages are sent by the QSH CL command when the
|
||
|
CMD parameter is specified. If the value is
|
||
|
"Y", the QSH0005 message is sent as an escape message if the exit status is
|
||
|
greater than zero and the QSH0006 and QSH0007 messages are always sent as escape
|
||
|
messages. There is no default value.</dd>
|
||
|
|
||
|
<dt><strong>QIBM_QSH_CMD_OUTPUT (Control output of QSH CL command)</strong></dt>
|
||
|
|
||
|
<dd>This variable controls the output from the QSH CL command when
|
||
|
the CMD parameter is specified. If the value
|
||
|
is "STDOUT", the output is displayed on the C runtime terminal session. If the
|
||
|
value is "NONE", the output is discarded. If the value is "FILE", the output is
|
||
|
written to the specified file. If the value is "FILEAPPEND", the output is
|
||
|
appended to the specified file. The default value is "STDOUT".</dd>
|
||
|
|
||
|
<dt>
|
||
|
<strong>QIBM_QSH_INTERACTIVE_CMD (Initial interactive command)</strong></dt>
|
||
|
|
||
|
<dd>When this variable is set to a command string, <strong>qsh</strong> runs the
|
||
|
command when an interactive session is started. The variable must be set
|
||
|
before calling the QSH CL command to have <strong>qsh</strong> run the command.
|
||
|
There is no default value.</dd>
|
||
|
|
||
|
<dt><strong>QIBM_QSH_INTERACTIVE_TYPE (Type of interactive session)</strong></dt>
|
||
|
|
||
|
<dd>This variable sets the type of the interactive session started by the QSH
|
||
|
CL command. If the value is "NOLOGIN", the interactive session is
|
||
|
not a login session. Otherwise the interactive session is a login session.
|
||
|
There is no default value.</dd>
|
||
|
|
||
|
<dt><strong>QIBM_SYSTEM_ALWMLTTHD (Allow multi-threaded jobs for system)</strong></dt>
|
||
|
|
||
|
<dd>This variable controls how the <a href="system.htm">system</a> utility
|
||
|
behaves in a multi-thread capable job. If the value of the
|
||
|
variable is "Y" and there is only one thread in the job,
|
||
|
<strong>system</strong> runs the CL command in the job. Otherwise, <strong>system</strong>
|
||
|
starts a new job to the run the CL command. There is no default value.</dd>
|
||
|
|
||
|
<dt><strong>QIBM_SYSTEM_USE_ILE_RC</strong></dt>
|
||
|
|
||
|
<dd>Set this environment variable to control how the <a href="system.htm">system</a>
|
||
|
utility sets the exit status. If the value of the variable is "Y",
|
||
|
<strong>system</strong> sets the exit status to the ILE return code of the
|
||
|
program called by the CL command, or zero if the program did not set a
|
||
|
return code. There is no default value.
|
||
|
</dd>
|
||
|
|
||
|
</dl>
|
||
|
|
||
|
</body>
|
||
|
</html>
|
||
|
|