I have a bash script that performs makes and then aborts when a make writes to stderr. The code is like this:
make all 2>${ERROR_FILE}
ERR=$(cat ${ERROR_FILE})
if [ ! -z "${ERR}" ];
then
abort "Halted because of errors in make $1: ${ERR}"
fi
However, make writes the following to the file:
ar: creating ../lib/libmgr.a
ar: creating ../lib/libnet.a
ar: creating ../lib/libeoc.a
ar: creating ../lib/libdvr.a
ar: creating ../lib/libmsg.a
ar: creating ../lib/liblgc.a
ar: creating ../lib/libshm.a
ar: creating ../lib/libsys.a
ar: creating ../lib/librsk.a
ar: creating ../lib/librep.a
ar: creating ../lib/libmdl.a
ar: creating ../lib/libmdb.a
ar: creating ../lib/libdat.a
ar: creating ../lib/libchs.a
What does this mean? Are these errors? If not, why are they written to stderr?
They don’t look like errors, they look like messages from ar. Why do you stop if the std err file is nonzero? Do you want to stop on warnings too? If not, you may want to stop based on the status of the make command (a non zero $? value after the make command indicates error).