Case (ksh) | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Case (ksh)

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 12-11-2003
435 Gavea 435 Gavea is offline
Registered User
 
Join Date: Oct 2003
Last Activity: 5 October 2006, 4:22 PM EDT
Location: Brazil
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Case (ksh)

Isn't any "NOT" operator that can be used in the case construction like :

case $VAR (NOT) in
option1 | option2 | option 3...) COMMAND ;;
esac


Or something similiar to the "default" from switch, so I could at least do something like this:

case $VAR in

option 1 | option 2 | option 3 ...) do nothing ;;
default) COMMAND ;;

If the answer is no,

I'll use a flag that is filled when VAR is one of the possible values...
Sponsored Links
    #2  
Old 12-11-2003
google's Avatar
google google is offline Forum Advisor  
Advisor
 
Join Date: Jul 2002
Last Activity: 17 June 2009, 5:17 PM EDT
Location: Atlanta
Posts: 740
Thanks: 0
Thanked 2 Times in 2 Posts
* can be the default


Code:
case $VAR in
     pattern1)
          statement 1
          ;;
     pattern2)
          statement 2
          ;;
       *)
         default statement
          ;;
esac

Sponsored Links
    #3  
Old 12-11-2003
linuxpenguin's Avatar
linuxpenguin linuxpenguin is offline Forum Advisor  
Registered User
 
Join Date: May 2002
Last Activity: 28 March 2014, 4:09 PM EDT
Location: India
Posts: 350
Thanks: 0
Thanked 5 Times in 5 Posts
case ${var} in
!pattern1)
statements
;;
!pattern2)
statements
;;
*)
statements
;;
esac
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Conversion from Upper Case to Lower Case Condition based tsbiju Shell Programming and Scripting 12 07-08-2011 02:53 PM
[Solved] Change Upper case to Lower case in C shell rockytodd Shell Programming and Scripting 3 11-04-2010 12:57 PM
Script needed to select and delete lower case and mixed case records abhilash mn Shell Programming and Scripting 1 03-17-2008 08:00 AM
lower case to upper case string conversion in shell script dchalavadi UNIX for Dummies Questions & Answers 3 05-29-2002 12:07 AM



All times are GMT -4. The time now is 11:25 AM.