[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Failed bash -r command returns 0 exit status
From: |
Dave Rutherford |
Subject: |
Re: Failed bash -r command returns 0 exit status |
Date: |
Mon, 24 May 2010 08:45:00 -0400 |
On Mon, May 24, 2010 at 08:32, Greg Wooledge <wooledg@eeg.ccf.org> wrote:
> On Mon, May 24, 2010 at 04:25:48AM -0400, Dave Rutherford wrote:
>> On Mon, May 24, 2010 at 02:48, Pitt, David <David.Pitt@anz.com> wrote:
>> > status. This is not expected (at least not by me!). Zero exit
>> > status is returned with
>> > any list of commands, e.g. "/bin/ls && :".
>>
>> That one would, since the second command is 'true'. Replace it
>> with 'false' and you should see an exit status of 1.
>
> You're confused. In a regular shell, the if the /bin/ls fails, the &&
> part never gets executed at all, and the entire thing returns non-zero.
>
> $ bash -c 'false && :'; echo $?
> 1
But it didn't fail because it wasn't run.