|
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.
|