Swaminathan K
asked on
Unix commands
Hi Team,
I need to know the difference between using single bracket , double bracket , open and close parenthesis in a if condition in UNIX script and mainly the use of ; after the if condition .
example
num=10
if [ $num -eq 10 ] ;
then
echo "number is equal to 10"
else
echo " number is not equal to 10"
fi
if [[ $num -eq 10 ]] ;
then
echo "number is equal to 10"
else
echo " number is not equal to 10"
fi
if (( $num -eq 10 ))
then
echo "number is equal to 10"
else
echo " number is not equal to 10"
fi
I need to know the difference between using single bracket , double bracket , open and close parenthesis in a if condition in UNIX script and mainly the use of ; after the if condition .
example
num=10
if [ $num -eq 10 ] ;
then
echo "number is equal to 10"
else
echo " number is not equal to 10"
fi
if [[ $num -eq 10 ]] ;
then
echo "number is equal to 10"
else
echo " number is not equal to 10"
fi
if (( $num -eq 10 ))
then
echo "number is equal to 10"
else
echo " number is not equal to 10"
fi
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.