Current-Users archive

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

Re: Identifying the NetBSD shell



In article <82EBF125-6F26-400A-8F22-C6836B810FB3%nimenees.com@localhost>,
Eric Haszlakiewicz  <erh%nimenees.com@localhost> wrote:
>On March 21, 2016 11:08:50 PM EDT, Kamil Rytarowski <n54%gmx.com@localhost> 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



Home | Main Index | Thread Index | Old Index