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

Create successful ePaper yourself

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

Options<br />

Operands<br />

Exit status<br />

Examples<br />

v -r file True if file exists and is readable.<br />

v -s file True if file exists and has a size greater than zero.<br />

v -S file True if file exists and is a socket.<br />

v -t fd True if file descriptor fd is open and associated with a terminal.<br />

v -u file True if file exists and its set user id flag is set.<br />

v -w file True if file exists and is writable.<br />

v -x file True if file exists and is executable. This only means that the execute bit is<br />

on. If file is a directory, the directory can be searched.<br />

v -z string True if the length of string is zero.<br />

v n1 -eq n2 True if the integers are equal.<br />

v n1 -ne n2 True if the integers are not equal.<br />

v n1 -gt n2 True if the first integer is greater than the second integer.<br />

v n1 -ge n2 True if the first integer is greater than or equal to the second integer.<br />

v n1 -ltn2 True if the first integer is less than the second integer.<br />

v n1 -le n2 True if the first integer is less than or equal to the second integer.<br />

v string True if string is not the null string.<br />

v string1 = string2 True if the strings are identical.<br />

v string1 != string2 True if the strings are not identical.<br />

The above primaries can be combined to form complex expressions using the<br />

following operators:<br />

v ! expr True if expr is false.<br />

v expr1 -a expr2 True if both expressions are true.<br />

v expr1 & expr2 True if both expressions are true.<br />

v expr1 -o expr2 True if either expression is true.<br />

v expr1 | expr2 True if either expression is true.<br />

v (expr) Parentheses are for grouping.<br />

The -a and & operators have higher precedence than the -o and | operators.<br />

See above.<br />

All operators and flags are separate arguments.<br />

v 0 when expression is true.<br />

v 1 when expression is false.<br />

v >1 when there is an error.<br />

1. See if /home is a directory: test -d /home<br />

2. See if one integer is less than or equal to another: test“$index” -le “$count”<br />

3. See if two strings are equal: test“$REPLY” = “Yes”<br />

Chapter 4. Utilities 103

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

Saved successfully!

Ooh no, something went wrong!