On Wed, Aug 30, 2006 at 01:01:06AM -0400, Paul Jarc wrote: > Greg Schafer <[EMAIL PROTECTED]> wrote: > > Thanks for trying to clarify it for me. Let me put it another way: If I > > change Line 1 above to an if/then style statement instead of "&&" ie: > > > > if false; then echo false; fi > > > > it works exactly like I'd expect instead of the counter-intuitive behavior > > when using &&. > > That's because the exit status if an "if" command with a false > condition and no "else" clause is 0, while the status of the "&&" > command is not. > > bash is behaving exactly as the documentation says: the function call > itself is a simple command, so if it returns nonzero, bash exits.
That is the crux of the problem. I was expecting the function to return zero. But as you quite rightly say, the exit status of the "&&" command in this instance is nonzero and this is the key point I was missing. It's covered in the "Lists of Commands" section of the manual: "The return status of AND and OR lists is the exit status of the last command executed in the list." Ok, sorted. Thanks for your patience. I'm gonna put this down as a trap for young players :-) Regards Greg _______________________________________________ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash