What should be the behavior of the following?

if cmd1
then
    cmd2
fi && if cmd3
then
   cmd4
fi

I've not joined two if's with a short-circuit boolean before, but I'm
suddenly working on a script where someone else has.

Playing around, it appears that cmd1 and cmd3 have no direct impact on
the exit codes of the two if's, while cmd2 and cmd4 do (if cmd1 or
cmd3 evaluate true).  Is this the defined behavior in POSIX shell?  In
bash?  In bash symlinked to /bin/sh?  In dash?

TIA!


Reply via email to