Link to home
Start Free TrialLog in
Avatar of Swaminathan K
Swaminathan KFlag for India

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
ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial