Answers for "check if variable equal to number bash"

2

check if variable is a number in bash

re='^[0-9]+$'
if ! [[ $yournumber =~ $re ]] ; then
   echo "error: Not a number" >&2; exit 1
fi
Posted by: Guest on April-15-2020

Code answers related to "check if variable equal to number bash"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language