Unix/Linux Go Back    


Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Case (ksh)

Shell Programming and Scripting


Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 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,
Linux
I'll use a flag that is filled when VAR is one of the possible values...
Sponsored Links
    #2  
Old Unix and Linux 12-11-2003
google's Unix or Linux Image
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 3 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 Unix and Linux 12-11-2003
linuxpenguin's Unix or Linux Image
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 Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux 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 03:53 PM
[Solved] Change Upper case to Lower case in C shell rockytodd Shell Programming and Scripting 3 11-04-2010 01:57 PM
Script needed to select and delete lower case and mixed case records abhilash mn Shell Programming and Scripting 1 03-17-2008 09:00 AM
lower case to upper case string conversion in shell script dchalavadi UNIX for Dummies Questions & Answers 3 05-29-2002 01:07 AM



All times are GMT -4. The time now is 01:48 PM.