Unix C++
Would you like to react to this message? Create an account in a few clicks or log in to continue.

error in while loop

2 posters

Go down

error in while loop Empty error in while loop

Post by aarthi Tue Mar 09, 2010 2:20 pm

i=0
echo "values are"
while [ $i -le 5 ]
do
echo $i
i=`expr i + 1`
done

error:
expr: non-numeric argument
./exwhile.sh: line 5: [: -le: unary operator expected

This is the error am getting...

aarthi

Posts : 12
Points : 22
Join date : 2010-02-26

Back to top Go down

error in while loop Empty Re: error in while loop

Post by Christopher Tue Mar 09, 2010 2:23 pm

change `expr i + 1` to `expr $i + 1`
Christopher
Christopher
Admin

Posts : 240
Points : 429
Join date : 2010-02-26
Age : 35

https://unixcpp.forumotion.com

Back to top Go down

error in while loop Empty Re: error in while loop

Post by aarthi Tue Mar 09, 2010 3:55 pm

thanks

aarthi

Posts : 12
Points : 22
Join date : 2010-02-26

Back to top Go down

error in while loop Empty Re: error in while loop

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum