#!/bin/ksh
echo -en "\033[1;32mEnter ACTIVATION KEY:\033[0m"
read ACTIVATION_KEY
case "$ACTIVATION_KEY" in +([a-z]|[A-Z]|[0-9]|'-'))
echo -e "\033[1;32mPatern Matched\033[0m"
;;
*)
echo -e "\033[1;32mYou seem to have entered wrong characters in both the earlier instances. Pattern matching failed\033[0m"
;;
esac
The above script works fine when the interpreter is ksh, but outputs the following error when #!/bin/bash is used as shebang:
test.sh: line 5: syntax error near unexpected token `('
test.sh: line 5: `case "$ACTIVATION_KEY" in +([a-z]|[A-Z]|[0-9]|'-'))'