true && false; echo success
returns the return code from echo
which is 0.
bash -c 'false && true'; echo $?
yields 1
as expected. Pheew!
Aside: bash -c 'set -e; false || false; echo success'; echo $?
yields return code 1
because second command does not execute echo
(stops at false
because errors stop the current command), note that success
is not printed.