On Wed, Jun 07, 2000 at 02:55:23PM -0400, Mike G wrote:
| > I recognize the following documentation from man bash, but it's not
| > clear just how high you can numerically climb,
As high as the open file descriptors. There used to be problems going past 9,
but I think they're gone now.
| > exactly how the
| > ampersand qualifies, or how does one determine what numeral level is
| > placed in the given position based on the given qualifiers. Do you
| > understand what direction and approach I'm taking?
|
| I do now.
| think that you have
| 1) stdout
| 2) stderr
| and how can you combine them
|
| I think there's no such thing as 5&>
Actually:
for any process, file descriptors 0 1 and 2 are stdin, stdout and stderr
respectively; all processes may expect these
for many reasons, a script may want to open more than these and thus will
use more numbers
for the < redirection, 0 is the default
for the > and >> redirections, 1 is the default
to apply a redirection to an arbitrary descriptor, prefix its number
to the < or > or >>
to redirect to an existing descriptor instead of a filename use &n
where n is the descriptor number; "&-" means close the descriptor
Go have a look at filter_fd:
http://www.zip.com.au/~cs/scripts/filter_fd
Then look at bgssh, tag_fd and colourise from the same directory for an
example of what I use this for.
Once you've figured out how those scripts work, you'll have most of this
under control.
A remark: it is better to attach stdin, stdout, stderr to /dev/null
than to close them. Some commands treat a closed handle differently to
an empty one. Commands making output (almost all of them) may
legitimately complain and abort if writes to stdout fail (because it's
closed). Also, programs which open files are given (by the OS) the
first free descriptor. If some of 0,1,2 are closed, they will be handed
out. Unexpected things can result from this. (From the OS's point of
view 0,1,2 aren't special; this behaviour is not a bug or misdesign.)
--
Cameron Simpson, DoD#743 [EMAIL PROTECTED] http://www.zip.com.au/~cs/
Heed the words of the dead, for they are the least likely to be trying to get
something from you. - Robert Crawford <[EMAIL PROTECTED]>
--
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.