In article <[email protected]>,
Eric Haszlakiewicz <[email protected]> wrote:
>On March 21, 2016 11:08:50 PM EDT, Kamil Rytarowski <[email protected]> wrote:
>>> if a script wants to know if it can safely redirect file
>>> descriptors >= 10 (answer for NetBSD right now is definitely no)
>>> that is a little difficult to embed in the script.
>>
>>Redirecting fd >= 10 is rather a specialized use-case. Is it possible
>>to detect it dynamically?
>
>It doesn't seem that specialized. I've seen scripts that do that with
>e.g. fd 99 as a way to pick some arbitrary high fd number that is
>unlikely to be used by other parts of the script.
>I'm pretty surprised that it wouldn't work in NetBSD's shell.
These horrid hacks that need "high enough" fds should go and we should
just support dynamic fd redirection like bash does:
$ exec {fd}>&1
$ echo ${fd}
10
$ echo "Some output" >&${fd}
christos