if else if (elif) conditions in linux shell scripting
by RameshKumar[ Edit ] 2010-01-23 15:57:14
Nested if else can be used as
#! bin/bash
cc=$1
if [ $cc == 0 ]
then
echo "zero"
elif [ $cc == 1 ]
then
echo "one"
elif [ $cc == 2 ]
then
echo "-"
else [ $cc == 3 ]
echo "\"
fi
The else if condition is used as elif in shell scripting.
if [ condition ]
then
......
elif [ condition ]
then
......
else [ condition ]
......
fi