help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to use redirection in a function so that the function callers do


From: Chet Ramey
Subject: Re: How to use redirection in a function so that the function callers don't need to know such details?
Date: Mon, 6 Apr 2020 22:07:52 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.6.0

On 4/6/20 9:41 PM, Peng Yu wrote:
> Thanks. I wasn't aware of the usage `{fd1}<&0`. Where is it documented
> in man bash?

"Each  redirection  that may be preceded by a file descriptor number may
instead be preceded by a word of the form {varname}.  In this case, for
each redirection operator except >&- and <&-, the shell will allocate a
file descriptor greater than or equal to 10 and assign it  to  varname.
If  >&-  or  <&- is preceded by {varname}, the value of varname defines
the file descriptor to close.  If {varname} is supplied, the  redirect-
ion  persists  beyond the scope of the command, allowing the shell pro-
grammer to manage the file descriptor himself."

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    address@hidden    http://tiswww.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]