/ Published in: Bash
checks for number character alphanumeric
Expand |
Embed | Plain Text
[[ -z "$1" ]] && echo "I cant work without an input" && exit 1 INPUT="$@" [[ "$INPUT" == ?(+|-)+([0-9]) ]] && echo "$INPUT is numeric" && exit 0 [[ "$INPUT" == +([a-zA-Z]) ]] && echo "$INPUT is character" && exit 0 [[ "$INPUT" == *([0-9]|[a-zA-Z])* ]] && echo "$INPUT is alpha-numeric" && exit 0
You need to login to post a comment.
