next up previous contents
Next: The case command Up: C Shell Programming Previous: Introduction   Contents

The if command

The sh program:-

 
if [ "$ans" = "yes" ]
then
  echo  "You agree"
elif [ "$ans" = "no" ]
then
  echo  "You don't agree"
else
  echo "pardon?"
fi

becomes the csh program:-

 
if ( "$ans" == "yes" ) then
  echo  "You agree"
else if ( "$ans" == "no" ) then
  echo  "You don't agree"
else
  echo "pardon?"
endif



P.D. Gronbech (IT Staff) 2015-10-02