How about just using /usr/bin/test and get rid of the expr. AFAIK, it should whine if the input is not numeric, eg:
jmuu@noodle:~$ i=4; test "$i" -ge -20 -a "$i" -lt 10 2> /dev/null; echo $? 0 jmuu@noodle:~$ i=abc; test "$i" -ge -20 -a "$i" -lt 10 2> /dev/null; echo $? 2 jmuu@noodle:~$ i=42; test "$i" -ge -20 -a "$i" -lt 10 2> /dev/null; echo $? 1
Or am I missing something here?
How about just using /usr/bin/test and get rid of the expr. AFAIK, it should whine if the input is not numeric, eg:
jmuu@noodle:~$ i=4; test "$i" -ge -20 -a "$i" -lt 10 2> /dev/null; echo $?
0
jmuu@noodle:~$ i=abc; test "$i" -ge -20 -a "$i" -lt 10 2> /dev/null; echo $?
2
jmuu@noodle:~$ i=42; test "$i" -ge -20 -a "$i" -lt 10 2> /dev/null; echo $?
1
Or am I missing something here?