|Text-only||Table of Contents (frame/ no frame)|
|(16) Conditional Tests|
testcommand, or its alias,
[, or the ksh/bash built-in
[[ ... ]]command, which has slightly different options, or it can be any command which returns a suitable exit status. Zero is taken to be "True", while any non-zero value is "False". Note that this is backwards from the C language convention.
-L= is a symlink.
[, the argument must be quoted, because if it is a variable that has a null value, the resulting expansion ( [ -z ] ) is a syntax error. An expansion resulting in "" counts as a null string.
[only, a quoted string alone is equivalent to the -n test, e.g. [ "$var" ]. In older shells for which
[is an external program, the only way to test for a null string is:
if [ "X$var" = "X" ]
This is rarely needed now, but is still often found.
$variable = text
$variable < text
>= comes after
|cond-tests.src last modified Feb 11, 2005||Introduction||Table of Contents
|© Dartmouth College|