Answers for "linux check if condition with number value"

2

bash if is number

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

bash check if variable is number

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 "linux check if condition with number value"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language