[unix] Check that a variable is a number in UNIX shell

No forks, no pipes. Pure POSIX shell:

case $var in
   (*[!0-9]*|'') echo not a number;;
   (*)           echo a number;;
esac

(Assumes number := a string of digits). If you want to allow signed numbers with a single leading - or + as well, strip the optional sign like this:

case ${var#[-+]} in
   (*[!0-9]*|'') echo not a number;;
   (*)           echo a number;;
esac