06 March 2012

if Conditional Statement in Shell Script

Leave a Comment

if Conditional Statement in Shell Script

courtesy-byterevel.com



Bash shell Script also provide if-else conditional statement like other programming languages. If-else statement helps to evaluate perform different computations or actions depending on whether a programmer-specified boolean condition evaluates to true or false.

There are three different if-else forms provided by shell script

1. if-else-fi


if condition
then
perform some action
else
perform other action
fi



2. if-fi

if condition
then
perform some action
fi

3. if-elif-else-fi

if condition 
then
perform some action
elif condition then
perform 2nd action
else
perform other action
fi


If You Liked This Post Please Take a Time To Share This Post

You May Also Like...

0 comments:

Post a Comment