On Tue, 11 Feb 2003, Gordon wrote:

> I've searched all over for an answer to this and haven't found one yet!
> 
> Is there a way in a bash script to test if a variable contains an 
> integer? I want to create a script that uses some simple arithmetic but 
> bash bombs out if you try to do a comparison or arithmetic with a 
> non-numeric value. Basically, something like:
> 
> read var
> if [ "$var" is a number ]; then
>       do something
> else
>       echo var is not a number
> fi

$ man expr

  the "expr" utility is, IMNSHO, sadly overlooked.

rday



-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to