Is there a way to check to see if the user entered variable is a valid integer?
I have:
...
read var
if test $var -lt 5
then
echo "integer"
fi
This works just fine if var is an integer, but if it is not, then I get a "bad integer" error. I would like it to not give an error, if that is possible.
Thanks for the help.
I have:
...
read var
if test $var -lt 5
then
echo "integer"
fi
This works just fine if var is an integer, but if it is not, then I get a "bad integer" error. I would like it to not give an error, if that is possible.
Thanks for the help.