man make:
Quote:
Exit Status
GNU make exits with a status of zero if all makefiles were successfully parsed and no targets that were built failed. A status of one will be returned if the -q flag was used and make determines that a target needs to be rebuilt. A status of two will be returned if any errors were encountered.
|
Your script:
Code:
make clean
make z
if [ $? -eq 0 ] ; then
do stuff when make succeeds
else
do stuff when make fails
fi
The test of the exit status must immediately follow the command you wish to test, since it changes with each new command. Capture it in a variable if you want to test later.