file descriptors, redirection and other animals....
From:
simonm
Subject:
file descriptors, redirection and other animals....
Date:
Mon, 9 Mar 2009 05:03:31 -0700 (PDT)
User-agent:
G2/1.0
Hi all,
Here's a quick one...
The following works as expected:
# exec 9<>test.file ; jot 50 >&9 ; tail -5 <&9 9>&-
46
47
48
49
50
The next one does not:
# exec 9<>test.file ; jot 50 >&9 ; head -5 <&9 9>&-
#
The question is: Why?
bash --version
GNU bash, version 3.2.17(1)-release (i386-apple-darwin9.0)
Copyright (C) 2005 Free Software Foundation, Inc.
I'd like to "split" output from a pipe to perform multiple end-steps
after a long-chain of pipes. FD redirection seems to be the best way.
Many thanks in advance for any ideas as to why "head" doesn't work and
"tail" does.
Thanks
SM