Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ERROR in basic script format!! 1

Status
Not open for further replies.
Sep 22, 2004
27
US
HI Gurus!!
I have written thie basic script..

awk '{for(i=0;i<=NR;i++) count=i}'< ${fileip} # count no of lines in fileip#
export env count
echo $count

case ${findsp} in
"r") export env sp="6" ;;
"m") export env sp="2" ;;
"l") export env sp="2" ;;
*) print "\n\n Warning - ASSIGNMENT CANNOT BE DETRMINED \n\n" ;;

if ( $count % $sp == 0)
then (sp_diff = $count / $sp )
export env sp_diff
fi

but i am repeatedly getting an error as:


if ( testx.ksh[168]: syntax error at line 176 : `(' unexpected
Also, is my assignment right in the awk statement. Im not familiar with unix but have got to do it for this particular chunk of my asisgnment.
Please advice on the above error.

Thank you in advance.
 
Assuming ksh:
typeset -i sp=0 count=$(wc -l < ${fileip})
# with awk: count=$(awk 'END{print NR}' $fileip)
export count
echo $count
case ${findsp} in
"r") export env sp="6" ;;
"m") export env sp="2" ;;
"l") export env sp="2" ;;
*) print "\n\n Warning - ASSIGNMENT CANNOT BE DETRMINED \n\n" ;;
esac
if ((sp)) && (((count%sp)==0)); then
typeset -i sp_diff=$((count/sp))
export sp_diff
fi

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top