The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 03-18-2008
gummysweets gummysweets is offline
Registered User
  
 

Join Date: Jun 2005
Location: London
Posts: 7
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
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:35 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0