29.06.2013 Views

Qshell Interpreter (qsh) - FTP Directory Listing - IBM

Qshell Interpreter (qsh) - FTP Directory Listing - IBM

Qshell Interpreter (qsh) - FTP Directory Listing - IBM

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Parameters<br />

Positional parameters<br />

Special parameters<br />

12 <strong>Qshell</strong> <strong>Interpreter</strong> (<strong>qsh</strong>)<br />

A parameter is used to store data. You can access the value of a parameter by<br />

preceding its name with a dollar sign ($) and surrounding the name with brackets ({<br />

}). The brackets are optional when the name is a single digit, or a special<br />

parameter, or the name is a single identifier. See “Parameter expansion” (page 16)<br />

for more information on expanding the value of a parameter.<br />

A positional parameter is a decimal number starting from one. Initially, <strong>qsh</strong> sets the<br />

positional parameters to the command line arguments that follow the name of the<br />

shell script. The positional parameters are temporarily replaced when a shell<br />

function is called and can be reassigned using the set and shift utilities.<br />

A special parameter is denoted by one of these special characters:<br />

* (Positional parameters)<br />

(Asterisk) Expands to the positional parameters, starting from one. When<br />

the expansion occurs within a double-quoted string it expands to a single<br />

field with the value of each parameter separated by the first character of the<br />

IFS variable, or by a if IFS is unset.<br />

@ (Positional parameters)<br />

(Ampersand) Expands to the positional parameters, starting from one.<br />

When the expansion occurs within double-quotes, each positional<br />

parameter expands as a separate argument. If there are no positional<br />

parameters, the expansion of @ generates zero arguments, even when @<br />

is double-quoted.<br />

# (Number of positional parameters)<br />

(Number sign) Expands to the decimal number of positional parameters. It<br />

is initially set to the number of arguments when <strong>qsh</strong> is invoked. It can be<br />

changed by the set, shift, or dot utilities or by calling a function.<br />

? (Exit status)<br />

(Question mark) Expands to the decimal exit status of the most recent<br />

command. A value of zero indicates successful completion. A non-zero<br />

value indicates an error. A command ended by a signal has an exit status of<br />

128 plus the signal number.<br />

- (Option flags)<br />

(Minus) Expands to the current option flags (the single-letter option names<br />

concatenated into a string) as specified when <strong>qsh</strong> is invoked, by set, or<br />

implicitly by <strong>qsh</strong>.<br />

$ (Process ID of current shell)<br />

(Dollar sign) Expands to the decimal process ID of the current shell. A<br />

subshell retains the same value of $ as the current shell even if the<br />

subshell is running in a different process.<br />

! (Background process ID)<br />

(Exclamation mark) Expands to the decimal process ID of the most recent<br />

background command run from the current shell. For a pipeline, the<br />

process ID is that of the last command in the pipeline.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!