SOLVED: Advanced shell scripting question :-)

Bob Bell bobbell at zk3.dec.com
Fri Sep 6 10:41:34 EDT 2002


On Fri, Sep 06, 2002 at 09:44:53AM -0400, Steven W. Orr <steveo at syslang.net> wrote:
> {
>     p 2>&1 >&3 3>&- | tee err
> } 3>&1 | tee out
> 
> [This was so elegant I almost cried when I saw it.]

    What is the '3>&-' for?  I can't seem seem to find what '>&-' means,
plus it runs the same with or without this argument for me.

> {
>     lbuffer p 2>&1 >&3 3>&- | tee err
> } 3>&1 | tee out

    When I run this on my Tru64 box at work or on my Linux box at home
(which seems to be so underpowered that it doesn't have the
lines-out-of-order problem), I get an empty 'err' file.  Does this work
for everybody else?

    BTW, Steven, you might want to consider changing 'spawn' to 'spawn
-noecho'.

    I must say, though, the expect fakeout to get rid of buffering is
pretty cool...

-- 
Bob Bell <bobbell at zk3.dec.com>
-------------------------------------------------------------------------
 "Everything that can be invented has been invented."
   -- Commissioner, US Office of Patents, 1889



More information about the gnhlug-discuss mailing list