LadyDoor
August 25th, 2006, 07:16 PM
Is there a special syntax required to nest "if" statements in BASH? Basically, I want to set it up in this script I'm working on so that, if one thing has a certain value, then it should go one and do one of two things depending on whether something else has a given value, and if not to just do nothing...something like this (with dummy variables and numbers)
if (($statmente1 == 1))
then
if (($statement2 == 17))
then
command -options file
elif (($statement2 == 3))
then
othercommand
else
yetanothercommand
else
echo $statement1 > /dev/null
Basically, I want to do this because it'll save me a lot of "&&" statements. Any suggestions?
--Door
if (($statmente1 == 1))
then
if (($statement2 == 17))
then
command -options file
elif (($statement2 == 3))
then
othercommand
else
yetanothercommand
else
echo $statement1 > /dev/null
Basically, I want to do this because it'll save me a lot of "&&" statements. Any suggestions?
--Door