The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 10-18-2001
dezithug dezithug is offline
Registered User
  
 

Join Date: Oct 2001
Location: Los Angeles
Posts: 6
Question Bourne shell script need help please ?

i have this assignment.. and i mad this script but there is something wrong with it.. if anyone can tell me.. watz going on... i would appreciate it.. tHnX in advance..

Code:
count=1
val=$2
op=$1
ans=0
if [ $op = "-e" -o $op = "-o" ]
then
        if [ $op = "-e" ]
        then
                while [ $count -le $val ]
                do
                        ans=`expr $count % 2`
                        if [ $ans -eq 0 ]
                        then
                        echo "$count \c "
                        count=`expr $count + 1`
                        fi
                done
        elif [ $op = "-o" ]
        then
                while [ $count -le $val ]
                do
                        ans=`expr $count % 2`
                        if [ $ans -ne 0 ]   
                        then
                        echo "$count \c "
                        count=`expr $count + 1`
                        fi
                done
        fi
else
        while [ $count -le $val ]
        do
                echo "$count \c "
                count=`expr $count + 1`
        done
fi

ThnX again

added code tags for readability --oombera

Last edited by oombera; 02-20-2004 at 11:51 AM..