The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
case statement bkan77 Shell Programming and Scripting 5 09-11-2007 06:54 PM
Case statement problem gzs553 UNIX for Advanced & Expert Users 6 11-14-2006 04:24 PM
turning case into a if statement brentdeback Shell Programming and Scripting 2 12-03-2005 12:12 AM
Case Statement Zeta_Acosta Shell Programming and Scripting 19 04-06-2004 05:16 PM
case statement Bab00shka Shell Programming and Scripting 1 07-15-2002 06:31 AM

Closed Thread
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
  #1 (permalink)  
Old 09-04-2007
cosec cosec is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 12
with Regard to Case Statement

I need to check if $1 is A or B
I tried the following but it seems its not correct..would appreciate a suggestion ?


case "$1"
in
"A" || "B" )
;;
esac

Thanks
  #2 (permalink)  
Old 09-04-2007
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
Supporter
  
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,350
Code:
case $1 in
"A")
"B") #do something...
;;
*) #do something else
;;
esac
  #3 (permalink)  
Old 09-04-2007
cosec cosec is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 12
Yes That's possible but I prefer to find out if i can use an or statement
  #4 (permalink)  
Old 09-04-2007
robotronic's Avatar
robotronic robotronic is offline Forum Advisor  
Can I play with madness?
  
 

Join Date: Apr 2002
Location: Italy
Posts: 370
Code:
case "$1" in
   A|B) echo "A or B";;
esac
  #5 (permalink)  
Old 09-04-2007
cosec cosec is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 12
thanks !!! it works the way i want it to now...
Closed Thread

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 02:16 PM.


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