[Top][All Lists]

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

Re: Equivalent of ksh, zsh {N}<[WORD] ?

From: Chet Ramey
Subject: Re: Equivalent of ksh, zsh {N}<[WORD] ?
Date: Tue, 26 Aug 2008 16:29:27 -0400
User-agent: Thunderbird (Macintosh/20080707)

R. Bernstein wrote:
> Chet Ramey writes:
>  > R. Bernstein wrote:
>  > 
>  > > Right now what bashdb assumes that file descriptors 4 through 9 are
>  > > free, but it really has no right to assume that. And in fact, GNU
>  > > autoconf configure will use file descriptors in this range. Also using
>  > > 4-9 we is pretty limited in in file descriptors. This is less of an
>  > > issue, but still annoying and arbitrarily restrictive.
>  > 
>  > Why do you limit yourself to file descriptors 4-9?  Bash doesn't restrict
>  > you to single-digit fds.  I know there have been close-on-exec problems
>  > with fds > 10 in the past, but those should be fixed.
> bashref.texi says this:
>   Redirections using file descriptors greater than 9 should be used with
>   care, as they may conflict with file descriptors the shell uses
>   internally.
> I'm not sure I what this means. What "care" is supposed to be used?
> How do I find out what file descriptors bash has used internally, what
> from a debugger's standpoint the debugged program has opened, and
> what's free for me to use and how I can register that?  Not knowing
> this, the safest thing here seems to be to avoid file descriptors over
> 9 altogether.

The sentence is more a caution about the previously-mentioned clexec bugs.
As a practical matter, you should be able to use fds over 20 without
problems, but that is not portable across shells.

You should not need to know what fds bash is using, nor what is "free" to
use -- the idea is that bash will take care of saving and restoring file
descriptors when it needs to.  The requirement to know what file
descriptors you have open is new and not easily satisfied by the existing


needs to.

``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

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