Weird one, so the following will not log bash exit code...#!/usr/bin/env bashOUTPUT_PATH=${PROJECT_ROOT:-$PWD}/npm-install-output.lognpm --loglevel=warn --progress=false install > ${OUTPUT_PATH} 2>&1 &&export NODE_PATH=${NODE_PATH}:~/.suman/node_modules &&node $(dirname $0)/test.js &&EXIT=$? &&echo   && # newlineecho bash exit code => $? &&exit ${EXIT}if I remove one && after the node command like so:#!/usr/bin/env bashOUTPUT_PATH=${PROJECT_ROOT:-$PWD}/npm-install-output.lognpm --loglevel=warn --progress=false install > ${OUTPUT_PATH} 2>&1 &&export NODE_PATH=${NODE_PATH}:~/.suman/node_modules &&node $(dirname $0)/test.js  # <<<<< removed && charsEXIT=$? &&echo   && # newlineecho bash exit code => $? &&exit ${EXIT}then the node process will exit with a non-zero code, but then bash says:bash exit code => 0both of these are not giving correct results, there is something wrong with my code. I want to capture the correct exit code of the node process, and I want to print it out! What could be wrong?
Can't determine why exit code is not being logged
bash;shell script;exit;return status
$? is the exit status of your last command. In this case, it always return 0 because echo   was successfull. Please use $EXIT instead of $?#!/usr/bin/env bashOUTPUT_PATH=${PROJECT_ROOT:-$PWD}/npm-install-output.lognpm --loglevel=warn --progress=false install > ${OUTPUT_PATH} 2>&1 &&export NODE_PATH=${NODE_PATH}:~/.suman/node_modules &&node $(dirname $0)/test.js  # <<<<< removed && charsEXIT=$? &&echo   && # newlineecho bash exit code => $EXIT &&exit ${EXIT}