switch is a C shell, and C shell variant (tcsh), control construct. Only works with C shell/variant or C shell/variant scripts, not Bourne and family (sh, bash, ksh).
switch ( $reply ) case "1" : do this breaksw case "2" : do that breaksw case "3" : do something else breaksw default : punt breaksw endsw - rick warner On Wed, 18 Jun 2003, Steve Buehler wrote: > I am sorry, I wasn't paying attention to what I was doing. I thought I was > reading from the PHP mailing list, not the redhat list. > > Steve > > At 05:26 PM 6/18/2003 -0400, you wrote: > >This does not work! I get a syntax error > > > >./qadadmin: line 34: syntax error near unexpected token `$reply' > >./qadadmin: line 34: `switch($reply) {' > > > >At least i am not getting "command does not exist". > > > > > >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: "Steve Buehler" <[EMAIL PROTECTED]> > >To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > >Sent: Wednesday, June 18, 2003 5:12 PM > >Subject: Re: case? switch? I need to write a script and neither of these > >options work. > > > > > > > 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. > > > > > > > > >-- > >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