Consider this Bash script:
#!/bin/bash
echo Enter any character
read char
case $char in
[a-z]) echo Lower case letter
;;
[A-Z]) echo Upper case letter
;;
[0-9]) echo Number
;;
?) echo Special char
;;
*) echo You entered more than one character
;;
esac
If I enter 'a', the output is Lower case letter, and it is the same for 'A'… How do I overcome this?
Best Answer
For more information about the lower case regular expression of [a-z] and the upper case regular expression of [A-Z] in bash see Why isn't the case statement case-sensitive when nocasematch is off?.