![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Pattern Matching problem in UNIX | maxmave | Shell Programming and Scripting | 2 | 06-03-2008 02:19 AM |
| pattern matching problem | namishtiwari | Shell Programming and Scripting | 2 | 05-23-2008 08:33 AM |
| pattern matching | mercuryshipzz | Shell Programming and Scripting | 4 | 01-14-2008 11:01 PM |
| AWK pattern matching, first and last | smb_uk | Shell Programming and Scripting | 10 | 12-27-2007 09:03 PM |
| pattern matching problem | rein | Shell Programming and Scripting | 8 | 10-27-2007 12:44 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|