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.

expr<br />

Option<br />

Usage Note<br />

Examples<br />

Localization<br />

Exit Values<br />

expr does not consider ^ to be a metacharacter. If the regular expression<br />

contains \(...\), \) and it matches at least part of expr1, expr results in only<br />

that part; if there is no match, expr results in 0. If the regular expression<br />

doesn’t contain this construct, the result is the number of characters<br />

matched. The function match performs the same operation as the colon<br />

operator.<br />

substr expr1 expr2 expr3<br />

Results in the substring of expr1 starting at position expr2 (origin 1) for the<br />

length of expr3.<br />

index expr1 expr2<br />

Searches for any of the characters in expr2 in expr1 and results in the<br />

offset of any such character (origin 1), or 0 if no such characters are found.<br />

length expr1<br />

Results in the length of expr1.<br />

(expr) Groups expressions.<br />

–W Allows the expression to use hex and octal numbers.<br />

The parser stack depth is limited to 150 levels. Attempting to process extremely<br />

complicated expressions may result in an overflow of this stack, causing an error.<br />

1. The example<br />

fname=src/fn_abs.c<br />

expr $fname : ’*_\(.*\)\.c’<br />

returns abs.<br />

2. The example<br />

a=`expr $a + 1`<br />

adds 1 to the value of the shell variable a.<br />

expr uses the following localization environment variables:<br />

v LANG<br />

v LC_ALL<br />

v LC_COLLATE<br />

v LC_CTYPE<br />

v LC_MESSAGES<br />

v LC_SYNTAX<br />

v NLSPATH<br />

See Appendix F for more information.<br />

0 The result of expression is true.<br />

1 The result of expression is false.<br />

2 Failure due to any of following:<br />

v Not enough memory.<br />

266 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!