Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

bash if is number

re='^[0-9]+$'
if ! [[ $yournumber =~ $re ]] ; then
   echo "error: Not a number" >&2; exit 1
fi
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #bash #number
ADD COMMENT
Topic
Name
4+3 =