problem with CASE pattern matching

I am using ksh on a HP Ux. I have a simple script but am having problem with the case statement:-

#!/usr/bin/sh

Chl=�SM.APPLE_SWIFT_DV�
LoConfirm=��

case $chl in
[SM.APPLE_SWIFT_@(AL|DS|DU|DV)])
LoConfirm=�Using channel at Building 1�
echo �test conditon1�
echo $LoConfirm;;
[SM.APPLE_SWIFT_@(CV|CU|CS|BL)])
LoConfirm=�Using channel at Building 2�
echo �test condition2�
echo $LoConfirm;;
*) LoConfirm=�Unknown test�
echo $chl
echo $LoConfirm;;
esac

The variable alphachl can only contain one string which is either SM.APPLE_SWIFT_AL or SM.APPLE_SWIFT_DS or SM.APPLE_SWIFT_DU or SM.APPLE_SWIFT_DV. If it is one of these strings then prints a message "Using channel at Building 1". When I run the script, it just prints the messgae "Unknown test". I even tried to just insert the line [SM.APPLE_SWIFT_DV]) but still got the "Unknown test".

Is there anything wrong with my case syntax in particular the pattern matching bit please?

Thanks in advance...
Newbies.

Variables are case sensitive, Chl isn't used proper in your script.

Regards

The square brackets [] need to be quoted or escaped, as they are metacharacters for the case matching. It basically uses the same patterns as for file globbing (wildcards).

Also I don't think you can group substring alternatives inside parentheses.

Try this.

case $chl in
   '[SM.APPLE_SWIFT_@AL]' | '[SM.APPLE_SWIFT_@DS]' | '[SM.APPLE_SWIFT_@DU]' | '[SM.APPLE_SWIFT_@DV]DV)]') 
  ... etc