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. The internal structure of the function is irrelevant. What matters is the exit status of the simple command, not how that status is produced from other, possibly non-simple commands. If you want the function to never cause bash to exit, insert an extra "true" at the end. paul _______________________________________________ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash