if [[ $value =~ ^-?[0-9]+$ ]] ; then echo value is an integer else echo "value is not an integer" 1>&2 exit 1 fi