Am Samstag, 18. März 2006 16:11 schrieb Angus Leeming:
> Georg Baum <[EMAIL PROTECTED]> writes:

> Just a second... What does
>     foo || bar && baz
> mean? Does it mean:
> 1)
>     * Run "foo".
>     * If "foo" fails, run "bar".
>     * If "foo" succeeds, run "baz".
> Or does it mean:
> 2)
>     * Run "foo".
>     * If "foo" fails, run "bar".
>     * If "bar" succeeds, run "baz".
> 
> My understanding is that 1) is how the shell will interpret things.
> My understanding of your patch is that you think 2) is the way things 
work...

I believe that it is like this:
3)
        * Run "foo".
        * If "foo" fails, run "bar" and "baz".
        * If "foo" succeeds, run "baz".

(left to right evaluation, no precedence of && over || and vice versa)
My shell (bash, version 2.05b) agrees with me here.

> Change:
>     test -d lib || mkdir lib && cd lib && pthon ...
> to:
>     test -d lib || mkdir lib; cd lib && pthon ...

I will do the change nevertheless, since I don't know how other shells 
will interpret it.


Georg

Reply via email to