Newbie dot Org HomePage
Visit one of our web buddies
Newbie dot Org
Code Snippets

Shell -- A Survivor's Guide
A bash if/else

Ever wondered how to do a if/else under bash?
Here's how:

if [ "$VAR" = "string" ]; then
commands
commands
else
commands
commands
fi

This will check if the variable $VAR is equal to the string "string".
Experiment :)

Posted by Staunch on 09/22/99 at 18:41:36