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
If or Case Statement Ernst UNIX for Dummies Questions & Answers 1 09-24-2008 05:00 PM
sh -help with case statement (should be simple) kuliksco Shell Programming and Scripting 1 11-19-2007 10:04 PM
case statement bkan77 Shell Programming and Scripting 5 09-11-2007 05:54 PM
Case Statement Zeta_Acosta Shell Programming and Scripting 19 04-06-2004 04:16 PM
case statement Bab00shka Shell Programming and Scripting 1 07-15-2002 05:31 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-12-2008
c00kie88 c00kie88 is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 63
Red face case statement

Hi all,

I think i'm asking a sqtupid question here..

i'm using case sttament, what is the syntax or symbol for "or"?

I thought was ||

here a quick sample of my case statment

echo "Would you like to update your detail [Y/N]?"
read response
case $response in

"Y" || "y" )
echo "Please enter your new name
read name;;


"N" || "n")
echo "Bye bye"
exit;;

When i use above sytax, it complains "||" symbol

please help

Last edited by otheus; 10-12-2008 at 08:29 AM.. Reason: playfully Changing thread icon.
  #2 (permalink)  
Old 10-12-2008
c00kie88 c00kie88 is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 63
heheheh

don't worry..

figurd it out
silly me

using || instead of |
  #3 (permalink)  
Old 10-12-2008
vidyadhar85's Avatar
vidyadhar85 vidyadhar85 is offline Forum Staff  
Moderator(The Tutor)
  
 

Join Date: Jun 2008
Location: INDIA
Posts: 1,389
no need of using "|"
try
Code:
case $option in
[Yy])echo "YES";;
[Nn])echo "NO";;
*)exit;;
esac
Sponsored Links
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 12:43 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
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