delorie.com/archives/browse.cgi | search |
X-Spam-Check-By: | sourceware.org |
Date: | Wed, 26 Apr 2006 09:39:45 -0500 |
From: | mwoehlke <mwoehlke-nospam AT tibco DOT com> |
Subject: | Re: How do I detect a failure in Make? |
In-reply-to: | <10845a340604260701g2026a64fx5dac7fb5351b224a@mail.gmail.com> |
To: | cygwin AT cygwin DOT com |
Reply-to: | cygwin AT cygwin DOT com |
Message-id: | <444F8631.7000206@tibco.com> |
MIME-version: | 1.0 |
User-Agent: | Thunderbird 1.5 (X11/20051201) |
References: | <10845a340604260701g2026a64fx5dac7fb5351b224a AT mail DOT gmail DOT com> |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
Richard Quadling wrote: > I have the following bash script ... > > #!/bin/sh > cvs up 2> $HOME/cvs1.log > $HOME/cvs2.log > cd phpdoc > autoconf -v -d --warnings=all &> $HOME/autoconf.log > ./configure --with-source=./../php-src --with-pear-source=./../pear > --with-chm=yes --with-treesaving > $HOME/configure.log > make test > $HOME/make_test.log [ $? -eq 0 ] || exit $? > make test_xml > $HOME/make_test_xml.log [ $? -eq 0 ] || exit $? > make chm_xsl > $HOME/make_chm_xsl.log [ $? -eq 0 ] || exit $? > > Is there a way of stopping the makes if there was a problem. (additions in-line) You might want to try 'man bash'. Doing something based on the return status of a command is pretty basic. Also, TMTOWTDI: if [ $? -ne 0 ] ; then exit $? ; fi if [ $? -eq 0 ] ; then : ; else exit $? ; fi if ! make > log ; then exit $? ; fi if make > log ; then : ; else exit $? ; fi make > log || exit $? Note that using 'exit $?' is good practice because it means your *script* will fail, which means you can embed your *script* like you've embedded 'make' and take action based on if it succeeds or fails (this is ALWAYS good practice in the pipe-biased environment of UNIX). However, be careful that you don't do something that replaces $? with the exit status of someone other than 'make' (in which case you should either save the status or 'exit <non-zero constant>'). -- Matthew All of my signatures are 100% original. Including this one. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |