Check if an input is numeric or char

 With this script you can check if an argument to a script is numeric, char or alphanumeric.

 bash | 
 
 copy code |
?

01
[[ -z "$1" ]] && echo "I cant work without an input" && exit 1
02
03
04
05
INPUT="$@"
06
07
08
09
[[ "$INPUT" == ?(+|-)+([0-9]) ]] && echo "$INPUT is numeric" && exit 0
10