bug-bash
[Top][All Lists]
Advanced

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

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


From: Pierre Gaston
Subject: Re: Equivalent of ksh, zsh {N}<[WORD] ?
Date: Tue, 26 Aug 2008 16:35:56 +0300

On Tue, Aug 26, 2008 at 5:41 AM, R. Bernstein <rocky@panix.com> wrote:
> Both zsh and ksh have a way to open a file or duplicate a file
> descriptor and let the interpreter pick the descriptor saving the
> newly-allocated file descriptor number in a variable. In particular:
>
>   exec {fd}<&0
>
> will duplicate stdin and save the newly allocated file-descriptor
> number to fd. Also:
>
>   exec {fd}<filename
>
> opens filename with a new file descriptor and saves the number
> allocated in fd. Short of going outside of the language and using
> lsof, /proc, or the processes table, I haven't been able to figure out
> how to do the corresponding thing in bash. Is there a way?
>
> If not, it would be great if a future version had this extension that
> zsh and ksh both seem to have.
>
> Thanks!

This is a standard behaviour and you can do this in pretty much any
shell out there, including bash.




reply via email to

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