16.12.2012 Views

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

sh<br />

${parameter:+word}<br />

Expands to word, provided that parameter is defined and non-empty.<br />

${parameter+word}<br />

Expands to word, provided that parameter is defined.<br />

${parameter#pattern}<br />

Attempts to match pattern against the value of the specified parameter. The<br />

pattern is the same as a case pattern. sh searches for the shortest prefix of<br />

the value of parameter that matches pattern. If sh finds no match, the<br />

previous construct expands to the value of parameter; otherwise, the<br />

portion of the value that matched pattern is deleted from the expansion.<br />

${parameter##pattern}<br />

Is similar to the preceding construct, except that sh deletes the longest part<br />

that matches pattern if it finds such a match.<br />

${parameter%pattern}<br />

Searches for the shortest suffix of the value of parameter matching pattern<br />

and deletes the matching string from the expansion.<br />

${parameter%%pattern}<br />

Is similar to the preceding construct, except that sh deletes the longest part<br />

that matches pattern if it finds such a match.<br />

Arithmetic Substitution<br />

Arithmetic substitution is available with the syntax:<br />

$((arithmetic expression))<br />

or:<br />

$[arithmetic expression]<br />

This sequence is replaced with the value of arithmetic expression. Arithmetic<br />

expressions consist of expanded variables, numeric constants, and operators.<br />

Numeric constants have the forms:<br />

v A number that starts with 0x is hexadecimal<br />

v A number that starts with 0 is octal<br />

v A number that does not start with 0x or 0 is decimal<br />

v base #number, where base is a decimal integer between 2 and 36 inclusive, and<br />

number is any nonnegative number in the given base.<br />

Undefined variables evaluate to zero.<br />

The operators are listed in decreasing order of precedence in Table 27. Operators<br />

sharing a heading have the same precedence. Evaluation within a precedence<br />

group is from left to right, except for the assignment operator, which evaluates from<br />

right to left.<br />

Table 27. Shell Operators (sh command)<br />

Unary Operators<br />

− Unary minus<br />

! Logical negation<br />

+ ~ Identity, bitwise negation<br />

Multiplicative Operators<br />

* / % Multiplication, division, remainder<br />

562 z/<strong>OS</strong> <strong>V1R9.0</strong> <strong>UNIX</strong> <strong>System</strong> <strong>Services</strong> <strong>Command</strong> Reference

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

Saved successfully!

Ooh no, something went wrong!