> > May I suggest something like this: > > > > #!/bin/bash -e > > ... > > (make 2>&1 | tee log.make && exit $PIPESTATUS) && > > ... > > I use a lot 2>&1 | tee <file> in other work. First time I see it with > $PIPESTATUS though, and the whole () with &&. Interesting and > certainly very useful. I will try it, but perhaps not in building this > since I wonder, if make has an error, it will exit. It's only in the > case make is successful, but the input to make is not right or, what > make did for other reasons is not right. Is it ? You seem to say that > there can be errors and make will continue nevertheless, can this be > the case ?
Make may continue if it has a minor error, and of course, just because make finishes doesn't mean the program is right. Nevertheless, if make encounters a serious error, you really want it to stop there, before things spin into indecipherable chaos. (Speaking of which, if you're running parallel jobs the log is likely to be confusing enough. Sometimes one must startover with -j1.) The parens run the make|tee in a function-like subshell and the exit $PIPESTATUS sets the return code if any part of the pipe produces a return code, not just the last, i.e. the make, which is what we want. -- Paul Rogers [email protected] Rogers' Second Law: "Everything you do communicates." (I do not personally endorse any additions after this line. TANSTAAFL :-) -- http://lists.linuxfromscratch.org/listinfo/lfs-support FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page Do not top post on this list. A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail? http://en.wikipedia.org/wiki/Posting_style
