if else if (elif) conditions in linux shell scripting

by RameshKumar 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


Tagged in:

2141
like
0
dislike
0
mail
flag

You must LOGIN to add comments