Quote:
|
Originally Posted by malaymaru
How can I check numeric value in shell?
I am passing one parameter (integer) and I want to restrict any other characters except 0-9.
./script xyz 10
Here 2nd parameter (10) should be integer only.
|
Code:
case $2 in
*[^0-9]*) echo not integer; exit 1 ;;
esac