This is not really a RH issue, more of a shell issue.  The syntax
you have below is outright incorrect for Bourne/BASH shell, in that
the case statement is incomplete in the condition.

case $reply in
        A ) do this
                ;;
        B ) do that
                ;;
        * ) do nothing
                ;;
esac


Note that you left off the word 'in' in the condition for the 
'case' statement.  That is the syntax for Bourne shell 'case' statements 
for at least the past 25 years.  I would recommend a good shell book
if you will be doing much shell scripting.

- rick warner

On Wed, 18 Jun 2003, dlangschied wrote:

> 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

Reply via email to