The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 11-07-2006
BOFH BOFH is offline Forum Advisor  
Registered User
  
 

Join Date: Feb 2005
Location: Broomfield, CO
Posts: 406
You have to use the test construct in the if statement:


Code:
#!/usr/bin/ksh

echo Please enter number

while read n
do
  if [ $n=0 ]
  then
    exit
  else
    echo $n >> datafile
  fi
done