[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] [make] [ $$? -ne 0 ] && exit $$?



Hans Schou <sslug@sslug> writes:

> Subject-linjen fortæller sådan set det jeg gerne vil.
>
> I en Makefile udfører jeg nogle pg-sql ting
> create_foo:
> 	grep -v ^drop foo.sql | psql
>
> Nogle gange går det godt, andre gange galt. Jeg vil gerne have make 
> til at stoppe hvis det går galt.

Min make stopper helt af sig selv hvis en kommando i make-filen fejler,
så du må have gjort noget for at få den til at opføre sig anderledes.

> Jeg prøvede så med en:
> create_foo:
> 	grep -v ^drop foo.sql | psql
> 	[ $$? -ne 0 ] && exit $$?
>
> Men undersøgelse viste at $$? altid er 0, så den duer ikke.

Mon ikke det er fordi hver linie i en make-fil udføres i sin egen shell?

Betragt følgende make-fil:
#! /usr/bin/make -f

bad:
        @/tmp/exit.sh
        @echo "resultat: $$?"

ok:
        @/tmp/exit.sh ; echo "resultat: $$?"

(/tmp/exit.sh udfører en 'exit 1;')

Hvis jeg kører `make bad` siger den:
make: *** [bad] Fejl 1

Hvis jeg kører `make ok` siger den:
resultat: 1

.Henrik

-- 
if your typing speed is the main issue when you're
coding, you're doing something seriously wrong.
						-- citat Linus Torvalds


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-09-01, 02:01 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *