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
--
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list
- Re: Bash and testing a variable Gordon
- Re: Bash and testing a variable Robert Tinsley
- lpr printing error rahul b jain cs student
- Re: Bash and testing a variable Roland Roberts
- Re: Bash and testing a variable Anthony E. Greene
- Re: Bash and testing a variable Robert Tinsley
- Re: Bash and testing a variable Cameron Simpson
- Re: Bash and testing a variable Robert P. J. Day
- Re: Bash and testing a variable Gordon
- Re: Bash and testing a variable Robert P. J. Day
- Re: Bash and testing a variable Cameron Simpson