Originally Posted by basildon
I used this snippet of code to test whether a variable contains solely alphabetic characters.
case $var in
[A-Za-z]) echo "alpha"
*) echo "not alpha "
Testing the $var with all alphabetic characters resulted in the "not alpha" outcome
Could anyone please advise what is wrong?
Everything is correct, but you are writing the regex for one character.
[A-Za-z] will match a single character, so when you type a string it won't match. Change the regex to [A-Za-z]*
* ---> More than one character or combinations of this.....for more info...check out regular expressions.