stderr and scripting

Bill's LFS Login lfsbill at nospam.dot
Sat Nov 1 06:20:19 PST 2003


On Sat, 1 Nov 2003, Ken Moffat wrote:

> I'm writing a new set of scripts to build my lfs's (looking much more
> like the book, flagging each package to enable restarts, calculating
> space and time, ...) and I'm having problems with stderr messages in the
> logging.
>
>  A typical line will be something like
>
> make 2>&1 >>$LOG
>
>  What I'm noticing, particularly within `make check' (gcc and glibc,
> possibly also on others) is that warnings and errors are appearing on
> the console.  I've just looked at a glibc failure (seems to be in the
> math tests - this is a K6-2, so perhaps not unexpected) and realised
> that the relevant errors and warnings are definitely _not_ in the log.
>
>  I'm assuming I've just exposed my lack of scripting knowledge, so would
> anybody care to apply a clue bat (gently, please) ?

Just reverse the order oof the two redirections and you're good to go.
The 'man bash' states that order is significant, and it is, but fails to
also mention the exception, which is not involved woth your problem
here, but I thought I would mention it. If you are feeding a pipe, &2
has to be redirectoed to &1 *before*. Otherwise no-go. So

   cat xyz 2>&1 | less  # Bad example, but it demonstrates the point

is needed even though the man page indicates that this should not work
as it does.

>
> Ken
>

HTH

-- 
Bill Maltby
lfsbillATwlmcsDOTcom
Fix line above & use it to mail me direct.



More information about the lfs-support mailing list