[H-GEN] stderr redirection

Russell Stuart russell-humbug at stuart.id.au
Thu May 28 23:40:20 EDT 2009


On Fri, 2009-05-29 at 13:14 +1000, Stephen Thorne wrote:
> Using tee to get stderr in a file: 
> (printf "foo\n"; printf "bar\n" >&2) 3>&1 1>&2 2>&3 | tee stderr.txt


Oh, Clinton beware that both solutions hide the exit status of the make.
The exit status returned is that of the tee, which is always 0.

There are several ways around this.  Which is best depends on which you
care about more: portability or ugly code, and that means ugly even by
shell scripting standards.




More information about the General mailing list