Bash : how do i check the user input and make sure is only chracter or only number ?

Bash : how do i check the user input and make sure is only character or only number ?

one way

echo "$user_input" | tr -dc '[:digit:]' | read check_it
if [[ ${#check_it} -eq 0 ]] ; then
     echo 'all numbers'
fi
echo "$user_input" | tr -dc '[:alpha:]' | read check_it
if [[ ${#check_it} -eq 0 ]] ; then
     echo 'all alphabetic characters'
fi

if i only want to check the first digit wheter is a number "0" or not .
how to do it

echo "$user_input | grep -q '^0' && echo 'first character is zero'

grep for ^0

grep "^0"

i want check the user input and make sure only

[LEFT]alphabetic characters and spaces how i can do that?

"enter something"
read input

i want check the $input . how ?[/LEFT]

case $input in
  *[!0-9]*) case $input in
    *[! A-Za-z]*) echo not all numbers or all spaces+alphabetics;;
    *) echo all spaces or alphabetics;;
  esac;;
  *) echo all numbers;;
esac

jim - already replied to that

Just tweak it

echo "$abc" | sed 's/[a-zA-Z ]//g' | read val
if [[ ${#val} -eq 0 ]]
then
echo "alpha_space"
else
echo "not_alpha_space"
fi