bug-bash
[Top][All Lists]
Advanced

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

Re: Problem around brackets, && and ||


From: Kunszt Árpád
Subject: Re: Problem around brackets, && and ||
Date: Mon, 03 May 2010 22:08:33 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100501 Thunderbird/3.0.4

2010-05-03 21:25 keltezéssel, Greg Wooledge írta:
> On Mon, May 03, 2010 at 07:49:12PM +0200, Kunszt Árpád wrote:
>   
>> Description:
>>         If the last command in a {...} has && and fails and the {...}
>> has an || outside then the outside command will be executed.
>>     
> Use if/then/else/fi instead of && ||.  Using && || is dangerous, as I've
> explained here:
>
> http://mywiki.wooledge.org/BashPitfalls#cmd1_.26.26_cmd2_.7C.7C_cmd3
>
>
>   
I read it, thanks. I understand it now.

I read man bash lots of times, but this behavior had escaped my
attention. There isn't any word about cmd1 && cmd2 || cmd3 only the cmd1
&& cmd2 and cmd1 || cmd2 mentioned. I think lots of people, including
myself, thought that && and || is an equivalent to the if ... then ...
else statement.

So my bugreport is now against the documentation. :-)

Arpad




reply via email to

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