The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 01-05-2009
tostay2003 tostay2003 is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 23
variable numerical test

Hi

I have a variable which should be any number between 1 and 50.

It could also be any string/empty string.

I have a code written below. The point is when the variable contains string.
I don't want the code below to error out. Instead fall in the else bucket.


Code:
[ $var -lt 1 -o $var -gt 50 ] && dothis_1 || dothis_2