Beware: echo $$?

With 2 $, as that is a shell variable.

----- stephan
Sent from a mobile device, possibly from bed. Please excuse brevity and
typos.
On Feb 10, 2015 10:57 AM, "Reinier Post" <reinp...@win.tue.nl> wrote:

> On Mon Feb  9 12:35:36 2015, psm...@gnu.org (Paul Smith) wrote:
> > On Mon, 2015-02-09 at 16:19 +0000, David Aldrich wrote:
> > > If I deliberately introduce a syntax error into one of my C files,
> > > make calls gcc to build the file, as expected, and an error is
> > > reported as text in bash.  However, the exit code (checked using echo
> > > $?) returns 0.  If I run the gcc command from the bash command line,
> > > the exit code is 1.
> > >
> > > Why might make return 0 instead of 1 in the case of this compiler
> > > error?
>
> Guess: you're checking it like this:
>
> %.o: %.c
>         $(CC) -c -o $@ $<
>         @echo $?
>
> That won't work: each line will use a separate shell invocation, unless
>
> .ONESHELL:
>
> is specified.
>
> --
> Reinier Post
>
> _______________________________________________
> Help-make mailing list
> Help-make@gnu.org
> https://lists.gnu.org/mailman/listinfo/help-make
>
_______________________________________________
Help-make mailing list
Help-make@gnu.org
https://lists.gnu.org/mailman/listinfo/help-make

Reply via email to