pattern matching in an if-then

I'm having trouble getting my syntax right here; I want to test the value of $1 and return true if it is between 0 and 9. I've tried many combinations including

if [ $1 -eq [0-9] ]

but none have worked when passing, say, "5" into $1.

Any help is appreciated. Thanks.

if [ "$1" -gt 0 ] && [ "$1" -lt 10 ]

or

if (("$1" > 0)) && (("$1" < 10))

Regards

Thanks for the reply. I think I may have done a lousy job of articulating my objective though. I'm looking to test for the presence of a non-numeric character; the above will produce an error. Perhaps that's the only way to do this, i.e. test for an error in a numeric operation?

Thanks again.

One way but it just says there exists a non-numeric:

#!/bin/ksh
check=$( echo "1234x6789" | tr -dc '[:alpha:]' )
if [[ ${#check} -gt 0 ]] ; then
  echo 'found non-numeric'
else
   echo 'all numbers'
fi

You can also grep:

$(echo "1234x6789" | grep -q '[A-Z,a-z]') && echo 'found it'

Try:

case "$1" in
  [0-9]) echo "It's a digit!";;
  *) echo "Non-digit.";;
esac