Active Topics

 


Reply
Thread Tools
Posts: 429 | Thanked: 217 times | Joined on Apr 2010 @ Dubai
#1
okay guys i would really appreciate it if someone tells me how can i produce a command that goes as follow

Code:
echo $x

if [ 80 > $x > 20 ];then

Command

fi
ive tried this

Code:
if [ 80 -gt $x -gt 20 ]
and it failed to work

also tried


Code:
if [ $x -ge 20 ];
elif [ $x -le 80 ];then
same thing , didn't work


i would really appreciate some help as i know its simple to you but not me cause so far I've been stuck , as I'm working on this shell script and need to put the X between two values.

cheers,
bakuur
__________________
N900 @850Mhz
My N900 changed my life and made it ALOT easier!

Last edited by bakuur; 2010-11-10 at 22:01.
 
Posts: 388 | Thanked: 842 times | Joined on Sep 2009 @ Finland
#2
It should be
Code:
if [ $x -gt 20 ] && [ $x -lt 80 ]; then
     command
fi
 

The Following User Says Thank You to hqh For This Useful Post:
Posts: 306 | Thanked: 566 times | Joined on Jan 2010 @ Romania
#3
if [ $x -gt 20 -a $x -lt 80 ]
 

The Following User Says Thank You to blue_led For This Useful Post:
Posts: 429 | Thanked: 217 times | Joined on Apr 2010 @ Dubai
#4
Originally Posted by blue_led View Post
if [ $x -gt 20 -a $x -lt 80 ]
you know im doing that for the LED-Batt indicator
finally got the chance to work on it

hope this works really
__________________
N900 @850Mhz
My N900 changed my life and made it ALOT easier!
 
Posts: 306 | Thanked: 566 times | Joined on Jan 2010 @ Romania
#5
baftă ( romanian )
 
Posts: 429 | Thanked: 217 times | Joined on Apr 2010 @ Dubai
#6
Originally Posted by blue_led View Post
baftă ( romanian )
thanks a lot mate
__________________
N900 @850Mhz
My N900 changed my life and made it ALOT easier!
 
Reply


 
Forum Jump


All times are GMT. The time now is 19:07.