bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem with conditional syntax


From: Bob Proulx
Subject: Re: problem with conditional syntax
Date: Tue, 14 Nov 2006 11:18:56 -0700
User-agent: Mutt/1.5.9i

mrkiwi wrote:
> I am trying to write the code for this psudo code;
> 
> function askYN{
>     echo "continue?"
>     read the response into $response
> }

Can you show your actual askYN function?  You also need to screen all
user input for validity.

> This is what i have so far, but it complains (i think) because of the
> parameters passed into askYN. 
> I think i need to somehow bracket them
> 
> if [ askYN "Blah" -eq 0 ] && [ $response == "yes" ]

The if statement takes a command.  You want to call the command.
Don't put it through the [...] test wrapper.

  if ! askYN "Blah"; then
    if [ _"$response" = _"yes" ]; then

This reference might be useful to you.

  http://tldp.org/LDP/abs/html/

Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]