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

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
sh -help with case statement (should be simple) kuliksco Shell Programming and Scripting 1 11-19-2007 07:04 PM
case statement bkan77 Shell Programming and Scripting 5 09-11-2007 02:54 PM
with Regard to Case Statement cosec Shell Programming and Scripting 4 09-03-2007 11:15 PM
Case Statement Zeta_Acosta Shell Programming and Scripting 19 04-06-2004 01:16 PM
case statement Bab00shka Shell Programming and Scripting 1 07-15-2002 02:31 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 12-02-2005
Registered User
 

Join Date: Oct 2005
Location: Michigan
Posts: 7
Question turning case into a if statement

How can i convert this case statement that i made to an if statement? Do not write script, just give a hint on how to do something below.

#!/bin/sh
hi="$1"

case "$hi"
in
[Hh][iI]) exit 0;;
* ) exit 1;;
esac

echo "$hi"

Here is what i got so far for an if statement:

hi="$1"

if test "$hi" = hi (this is where i am stuck... how can i make it include
hi and also HI?
then
exit 0
else
exit 1
fi
Reply With Quote
Forum Sponsor
  #2  
Old 12-02-2005
Registered User
 

Join Date: Feb 2005
Location: Broomfield, CO
Posts: 401
hmm, just a hint, eh?

man ksh

search for "if"

read it.

You can also

man egrep

You can also buy the O'Reilly published Bill Rosenblatt authored Learning The Korn Shell.

(sounds like a classroom assignment to me but I can give hints )

Carl
Reply With Quote
  #3  
Old 12-02-2005
Registered User
 

Join Date: Oct 2005
Location: Michigan
Posts: 7
nevermind, after tinkering a while i got it to work. Mod you can close this thread now.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 03:59 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0