[H-GEN] stderr redirection

Russell Stuart russell-humbug at stuart.id.au
Fri May 29 02:22:14 EDT 2009


On Fri, 2009-05-29 at 14:43 +1000, Greg Black wrote:
> That seems like an ugly solution if you have to do it regularly (which
> is how I interpret the task you're describing).  I'd write a small
> wrapper in C (but you could do it just as easily in Python, etc) that
> ran the make after setting up the file descriptors/pipelines as required
> and then exited with the make status.  It's a couple of minutes using
> the standard templates and eleventy gazillion times simpler than trying
> to beat shells into submission.

Spoil sport.

But, if you are going to depend on a specific interpreter (Path, Perl or
C program), why not bash?  In terms of typing you just have to ensure
you have:

#!/bin/bash

at the top, and change the solution to:

(set -o pipefail; make all 1>&3 2>&1 | tee errors.txt) 3>&1 1>&2

Anyhow, what is so wrong with the portable version:

set -e
(exit `(((make 1>&3 || echo $? 1>&4) 2>&1 | tee errors.txt 1>&2) 4>&1) | cat`) 3>&1

I have to add it is lovely having this sort of discussion on Humbug.  It
has been years ...




More information about the General mailing list