![]() |
Type in a command, or "ls dictionary" to search all commands for "dictionary", etc.
|
NAME
iff - compare two values and return a value based on the result.
SYNOPSIS
iff <value1> [-lt|gt|le|ge|eq|ne <value2>] [-then <result1>] [-else <result2>] [-follow True|False]
EXAMPLES
iff 1 -lt 2 -then yes -else no
(returns "yes" since "1" is less than "2")
iff -eq ${var} -then yes -else no
(returns "yes" if var is empty, "no" otherwise)
iff True -then yes -else no
(returns "yes")
iff False -then yes -else no
(returns "no")
iff abc -eq bcd -then http://google.com -else http://yahoo.com -follow True
(returns the Yahoo! webpage)
DESCRIPTION
Either compares two values, or checks for the truth of a value.
All values other than "False", "No", "0" and "" are interpreted
as True.
Permitted comparisons are:
-lt (Less Than)
-gt (Greater Than)
-le (Less than or Equal)
-ge (Greater than or Equal)
-eq (EQual)
-ne (Not Equal)
When checking if a variable is empty, the variable has to
be specified behind the comparison switch:
iff -eq ${var} -then yes -else no
The following WILL NOT work:
iff ${var} -eq -then yes -else no
If the -follow switch is set to "True", iff tries to follow links
that begin with "http://". The default setting for -follow is "False".
AUTHOR
Samuel Hoffstaetter "http://shoffsta.linuxside.org/"
based on "IfThen" by Allen Ormond <aormond (at) fromrocks (dot) com>