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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shell script and to check numbers

Status
Not open for further replies.

Chrissirhc

Programmer
May 20, 2000
926
GB
Hi

If I do this:

NUMBER=10

if [ $NUMBER < 10 ]
then
echo 'number is less than 10'
else
echo 'number is not less than 10'

It doesn't work. I get the error &quot;Else unmatched&quot;. What am I doing wrong?

Thanks,

Chris
 
NUMBER=10

if [ $NUMBER < 10 ]; then
echo 'number is less than 10'
else
echo 'number is not less than 10'
fi;

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
[tt]
NUMBER=10

if [ $NUMBER -lt 10 ]
then
echo 'number is less than 10'
else
echo 'number is not less than 10'
fi
[/tt]

Jean Pierre.
 
Oh dear :) (I'm no scripting expert, but I'm a bit annoyed I didn't see that)

I forgot the fi and it is -lt..

Cheers,

Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top