On Thu, 17 Jan 2019 13:24:54 -0800 Paul Rogers <[email protected]> wrote:
> May I suggest something like this: > > #!/bin/bash -e > ... > (make 2>&1 | tee log.make && exit $PIPESTATUS) && > ... > > This way you'll see thing whipping past as long as there are no > return codes, but if something does error out, the script will stop > and you'll have a file of the console log to dissect. PIPESTATUS > isn't very well known but works a charm in this application. I've > been doing this for 15 years. ;-) 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 ? This problem here looks more like the input is wrong. It might not return any errors. Well, it certainly does not from the process itself. I also catch errors as I've mentioned at the beginning, since everything is scripted, by testing the $? variable eg. make [ "$1" != "" ] && logError $1 exit 1 logError puts it in a file. When doing the build I do a tail -f on the generated log file which goes like this for each package: util-linux-2.32.1 Package(s): util-linux-2.32.1.tar.xz Install directory: util-linux-2.32.1/ Start: Thu Jan 17 18:38:37 UTC 2019 End: Thu Jan 17 18:40:39 UTC 2019 Every single command from the book has a $? test after it, even the most simple ones. When I was about to restart ch5 for the third time I thought, wait, let's put that in writing, in scripts. It'll be easier to troubleshoot. -- 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
