switch($reply) {
case "1" :
        do this
        exit();
        break;
case "2" :
        do this
        exit();
        break;
case "3" :
        do this
        exit();
        break;
default :
        do this
        exit();
        break;
}

At 04:46 PM 6/18/2003 -0400, dlangschied wrote:
Sorry, I did not include the "in" after $reply and the case statement works.
I am still curious about switch.

Sincerely,

David Langschied
Langschied Consulting Services
25644 Mackinac
Roseville, MI 48066

Phone:  (586)777-7542
Cell:      (248)789-8493
e-mail:  [EMAIL PROTECTED]
----- Original Message -----
From: "dlangschied" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 18, 2003 4:38 PM
Subject: case? switch? I need to write a script and neither of these options
work.


> Hi all! > > I am having a bit of difficulty with writing a script. I am on Linux 8.0 > and trying to run a case statement like a would in HP-UX. This is not > working. I looked up the man page on case and it indicated that it was > being obsoleted. The man page suggested that I use switch. When I attempt > to do so, I get a "command not found" error. I am completely lost on what > to do next. > > Here is the gist of my case statement a la HP-UX: > > read reply > case $reply > 1) > Do this > ;; > 2) > Do this > ;; > 3) > Do this > ;; > 'x|X') > Exit > ;; > *) > echo error > ;; > esac > > Please help, I need to be able to read in a value from a menu and run a > corresponding script. > > > Sincerely, > > David Langschied > Langschied Consulting Services > 25644 Mackinac > Roseville, MI 48066 > > Phone: (586)777-7542 > Cell: (248)789-8493 > e-mail: [EMAIL PROTECTED] > > > -- > redhat-list mailing list > unsubscribe mailto:[EMAIL PROTECTED] > https://www.redhat.com/mailman/listinfo/redhat-list


-- redhat-list mailing list unsubscribe mailto:[EMAIL PROTECTED] https://www.redhat.com/mailman/listinfo/redhat-list

--
This message has been scanned for viruses and
dangerous content by the MailScanner at ow4, and is
believed to be clean.



-- redhat-list mailing list unsubscribe mailto:[EMAIL PROTECTED] https://www.redhat.com/mailman/listinfo/redhat-list

Reply via email to