Hi,
I have a bash script which calls a few "make". I would like to know whether the makefile failed with any errors. How do I do that in the script?
Thanks,
S
Hi,
I have a bash script which calls a few "make". I would like to know whether the makefile failed with any errors. How do I do that in the script?
Thanks,
S
make > log 2>&1
if [ "$?" -ne 0 ]; then
echo "Build failed"
cat log
fi
The above explained if you're new, "Run make and redirect both the errors and the standard output to 'log'. If the exit status of make '$?' is not equal to 0 ( -ne 0 where exit status 0 means it ran successfully) then say "Build failed" and show log file. Not that you needed it but someone else reading it may.