[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Checking the exit status of a command executed from within a GNUmake
From: |
Paul D. Smith |
Subject: |
Re: Checking the exit status of a command executed from within a GNUmakefile |
Date: |
Thu, 17 Feb 2005 17:26:25 -0500 |
%% Benjamin Edwards <address@hidden> writes:
be> I'm having trouble getting the exit status of a
be> command executed from within a GNUmakefile. I'm
be> executing the command using backticks, but I'm not
be> able to get the exit status of that command. I'm
be> trying to access the exit status using "$?", but that
be> doesn't seem to work for me.
be> example snippet -
be> target: clean
be> for file in $(FILES) ; do \
be> echo " => Processing $$file" ; \
be> `<command>` ; \
Why are you using backticks? The only thing this does is collect the
stdout then throw it away (since you're not assigning it to any
variable).
If you want to throw out stdout the traditional way to do it is:
<command> >/dev/null
be> echo "RETURN CODE == $?" ; \
You have to quote the "$". This is being expanded to the make automatic
variable $?, which is not what you want. Use $$? instead.
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> Find some GNU make tips at:
http://www.gnu.org http://make.paulandlesley.org
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist