I have the following snippet working such that my bash script exits early on failure
./gradlew clean build release
if [ $? -eq 0 ]
then
echo "Successfully BUILT FAKE RELEASE"
else
echo "BUILDING FAKE RELEASE FAILED"
exit $?
fi
I see the failure log statement BUT my script that calls it continues on instead of exiting and in that script, I have pretty much the same code
./runAllTesting.sh
if [ $? -eq 0 ]
then
echo "Successfully RAN ALL TESTING"
else
echo "TESTING SYSTEM Failed(don't release this)"
exit $?
fi
What am I doing wrong here? This is on 10.11.6 el capitan mac computer.
$?in theexitparameter will always return success because the command preceding it isecho, which will always succeed