for a non bashism version (as long as parameters don't contain spaces)MochiMoppel wrote:For a bullet proof check this should do:Code: Select all
[[ $N =~ ^-?[0-9]+$ ]] || exec echo $N is not an integer
Code: Select all
isnumber() [[ $(($1+0)) = ${1} ]]