Variables

When it is started, qsh 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:

Variable names can contain alphabetic characters, numeric characters, or the underscore (_). A variable name cannot begin with a numeric character.

Variables set by qsh

_ (Temporary variable)
This variable is set by qsh to the last argument of the previous simple command.
EGID (Effective primary group identifer)
This variable set by qsh to the effective primary group identifier of the process at the time qsh is started. This variable is read-only.
EUID (Effective user identifer)
This variable set by qsh to the effective user identifier of the process at the time qsh is started. This variable is read-only.
GID (Primary group identifer)
This variable set by qsh to the primary group identifier of the process at the time qsh is started. This variable is read-only.
HOSTID (IP identifier of host)
This variable set by qsh to the IP address of the host system.
HOSTNAME (Name of host)
This variable set by qsh to the name of the host system.
HOSTTYPE (Type of host)
This variable set by qsh to a string that represents the type of the host system. The value is set to "powerpc".
JOBNAME (Qualified job name)
This variable is set by qsh to the qualified job name of the current job. The qualified job name is used by CL commands to identify a job.
LAST_JOBNAME (Qualified job name of last job)
This variable is set by qsh to the qualified job name of the last job it started. The qualified job name is used by CL commands to identify a job.
LINENO (Line number)
This variable is set by qsh to the current line number (decimal) in a script or function before it runs each command.
MACHTYPE (Machine type)
This variable is set by qsh to a string that represents the machine type. The value is set to "powerpc-ibm-os400".
OLDPWD (Previous working directory)
This variable is set by cd to the previous working directory after the current working directory is changed.
OPTARG (Option argument)
This variable is set by getopts when it finds an option that requires an argument.
OPTIND (Option index)
This variable is set by getopts to the index of the argument to look at for the next option. The variable is set to one when qsh, a script, or a function is invoked.
OSTYPE (Operating system type)
This variable set by qsh to a string that represents the operating system type. The value is set to "os400".
PPID (Parent process ID)
This variable is set by qsh 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.
PWD (Working directory)
This variable is set by cd to the current working directory after it is changed.
QSH_VERSION (Current version)
This variable is set by qsh 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.
RANDOM (Random number generator)
This variable is set by qsh 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.
REPLY (Reply variable)
This variable is set by read 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.
TERMINAL_TYPE (Type of terminal)
This variable is set by qsh 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.
UID (User identifer)
This variable set by qsh to the user identifier of the process at the time qsh is started. This variable is read-only.

Variables used by qsh

CDPATH (Search path for cd)
If the directory you specify for cd does not begin with a slash (/), qsh searches the directories listed in CDPATH 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.
ENV (Environment file)
When qsh 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.
HOME (Home directory)
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 cd. The value is set by default to the value specified in your user profile.
IFS (Internal field separators)
The value is a string treated as a list of characters that is used for field splitting and to split lines into fields with read. The first character of the value is used to separate arguments when expanding the * special parameter. The default value is "<space><tab><newline>".
LANG (Language locale)
This variable defines the locale category used for categories that are not specifically set with a variable starting with LC_. There is no default value.
LC_ALL (Locale settings)
This variable overrides the value of any variables starting with LC_. There is no default value.
LC_COLLATE (Locale collation)
This variable defines the collation relations between characters. There is no default value.
LC_CTYPE (Locale character classes)
This variable defines character types such as upper-case, lower-case, space, digit and, punctuation. There is no default value.
LC_MESSAGES (Locale message formatting)
This variable defines the format and values for affirmative and negative responses from applications. There is no default value.
LC_MONETARY (Locale monetary formatting)
This variable defines the monetary names, symbols, and other details. There is no default value.
LC_NUMERIC (Locale numeric formatting)
This variable defines the decimal point character for formatted input/output and string conversion functions. There is no default value.
LC_TIME (Locale time formatting)
This variable defines the date and time conventions, such as calendar used, time zone, and days of the week. There is no default value.
LC_TOD (Locale time zone)
This variable defines the time zone name, time zone difference, and Daylight Savings Time start and end. There is no default value.
NLSPATH (Search path for message catalogs)
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.
PATH (Search path for commands)
If the command you specify does not begin with a slash (/), qsh 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:".
PS1 (Primary prompt string)
When the interactive option is set, qsh performs parameter expansion, command substitution, and arithmetic expansion on the variable and displays it on stderr when qsh is ready to read a command. The default value is "$".
PS2 (Secondary prompt string)
When you enter <newline> before completing a command qsh displays the value of this variable on stderr. The default value is ">".
PS3 (Select command prompt)
When the select compound command is run, qsh 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 select. The default value is "#?".
PS4 (Debug prompt string)
When the execution trace option is set and the interactive option is set, qsh 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 "+".
QIBM_CCSID (CCSID for translation)
When this variable is set to a numeric value, qsh 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.
QIBM_CHILD_JOB_SNDINQMSG (Send inquiry message when child process starts)
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.
QIBM_MULTI_THREADED (Start multi-thread capable processes)
This variable determines if processes started by qsh can create multiple threads. When the value of the variable is "Y", all child processes started by qsh can start threads. The default value is "N".
QSH_REDIRECTION_TEXTDATA (Process data as text for file redirection)
This variable determines if data read from or written to a file specified on a redirection is treated as text data or binary data. When the value of the variable is "Y", qsh treats the data read from or written to the file as text data. When the value of the variable is not "Y", qsh treats the data read from or written to the file as binary data. The default value is "Y".
QSH_USE_PRESTART_JOBS (Use pre-start jobs when available)
This variable determines if processes started by qsh use prestart jobs when available. When the value of the variable is "Y", qsh 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 qsh are batch immediate jobs. The default value is "Y".
SHELL (Path name of the shell)
When running a script file that does not contain "#!" on the first line, qsh uses the value of this variable as the path name of the shell interpreter to run the script. There is no default value.
TRACEFILE (Path name of trace file)
When the trace option is set, qsh 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".
TRACEOPT (Options for trace file)
When the trace option is set, qsh uses the value of this variable to determine how to handle the trace file. When the value of the variable is "UNLINK", qsh unlinks the trace file before opening it in a root shell. When the value of the variable is "KEEP", qsh keeps the current trace file. The default value is "UNLINK".

Other variables

Start of changeQIBM_CMP_FILE_SIZE
This variable controls the maximum file size in bytes that cmp reads into an internal buffer for better performance. For files larger than the maximum size, cmp reads the files one byte at a time. End of change
QIBM_OD_OUTPUT_FORMAT (Output format for od)
This variable controls the output format for the od utility. If the value is "OLD", od 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.
QIBM_QSH_CMD_ESCAPE_MSG (Send escape messages from QSH CL command)
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.
QIBM_QSH_CMD_OUTPUT (Control output of QSH CL command)
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".
QIBM_QSH_INTERACTIVE_CMD (Initial interactive command)
When this variable is set to a command string, qsh runs the command when an interactive session is started. The variable must be set before calling the QSH CL command to have qsh run the command. There is no default value.
QIBM_QSH_INTERACTIVE_TYPE (Type of interactive session)
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.
QIBM_SYSTEM_ALWMLTTHD (Allow multi-threaded jobs for system)
This variable controls how the system 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, system runs the CL command in the job. Otherwise, system starts a new job to the run the CL command. There is no default value.
QIBM_SYSTEM_USE_ILE_RC
Set this environment variable to control how the system utility sets the exit status. If the value of the variable is "Y", system 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.