View Single Post

   
  #2 (permalink)  
Old 02-27-2008, 12:10 PM
Jonathan Leffler
 
Posts: n/a
Default Re: script in makefile problem

%NAME% wrote:
> I wish to put a number of .db2 scripts in my makefile. However,
> some of the db2 scripts tries to revoke privileges from users that
> might do not have that privilege already, thus returns an error to
> the
> shell. I do not want the makefile to stop there, but simply ignore the
> errors.
>
> For example, I have the following in my makefile
>
> run:
> db2 -td@ script1.db2
> db2 -td@ script2.db2
>
>
> suppose one of the commands in script1.db2 fails (but does not
> create a problem at all, like trying to drop a table that does not
> exist), the makefile will not proceed to the second script file.
>
> How do i revise the commands so the makefile will run the second
> script even if some of the commands in the first script fails?


Standard prefixes for command lines in makefiles are @ and -. The @
means 'do not echo', and the '-' means ignore errors. Put a '-' in
front of each command that might fail. It goes after the leading tab
and before anything else (except, perhaps, the @).

There are other more radical ways of ignoring errors in makefiles (-k
option is OK in context, but this isn't one of those contexts; -i is
usually not OK; and .IGNORE doesn't bear thinking about).

--
Jonathan Leffler #include <disclaimer.h>
Email: jleffler@earthlink.net, jleffler@us.ibm.com
Guardian of DBD::Informix v2007.0226 -- http://dbi.perl.org/
Reply With Quote