Type in a command, or "ls dictionary" to search all commands for "dictionary", etc.

if

(This command has been awarded a Yubnub Golden Egg)

ifthen -value1 ${lt}${gt}${le}${ge}${eq}${ne} -value2 -test EQUAL -then {ifthen -value1 %s -value2 False -test EQUAL -then ${else} -else {ifthen -value1 %s -value2 No -test EQUAL -then ${else} -else {ifthen -value1 %s -value2 0 -test EQUAL -then ${else} -else {ifthen -value1 %s -value2 -test EQUAL -then ${else} -else ${then} -redirect ${follow}} -redirect ${follow}} -redirect ${follow}} -redirect ${follow}} -else {ifthen -value1 %s -value2 ${lt}${gt}${le}${ge}${eq}${ne} -test {ifthen -value1 -value2 ${eq} -test EQUAL -then {ifthen -value1 -value2 ${gt} -test EQUAL -then {ifthen -value1 -value2 ${lt} -test EQUAL -then {ifthen -value1 -value2 ${ge} -test EQUAL -then {ifthen -value1 -value2 ${le} -test EQUAL -then NOTEQUAL -else LESSEQUAL} -else GREATEREQUAL} -else LESS} -else GREATER} -else EQUAL} -then ${then} -else ${else} -redirect ${follow}}
NAME
    if - compare two values and return a value based on the result.

SYNOPSIS
    if <value1> [-lt|gt|le|ge|eq|ne <value2>] [-then <result1>] [-else <result2>] [-follow True|False]

EXAMPLES
    if 1 -lt 2 -then yes -else no
        (returns "yes" since "1" is less than "2")
    if -eq ${var} -then yes -else no
        (returns "yes" if var is empty, "no" otherwise)
    if True -then yes -else no
        (returns "yes")
    if False -then yes -else no
        (returns "no")
    if 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:
        if -eq ${var} -then yes -else no
    The following WILL NOT work:
        if ${var} -eq -then yes -else no

    If the -follow switch is set to "True", if 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>

    
5662 uses - Created 2005-06-11 00:42:34 - Last used 2013-05-21 14:16:36
Is this command broken? Tell Jon if you know how to fix it.