[olug] testing order in elif

02fun-u2 02fun-u2 at excite.com
Wed Mar 12 03:34:39 UTC 2008


when using elif to test a condition does elif test every condition or just match the first one and do the requested action and quit processing any other part of the elif…. Like linux ipfilter tables


if [[ $person = steve ]]
    then
        print $person is on the sixth floor.
    elif [[ $person = todd ]]
    then
	print $person is on the fifth floor.
    elif [[ $person = markus ]]
    then
	print $person is on the fifth floor.
    else
        print "Who are you talking about?"
    fi

script example stolen from
http://courses.cs.vt.edu/~cs2204/summer2003/notes/scripts-i.html

_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!





More information about the OLUG mailing list