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

2008-08-26 Thread R. Bernstein
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. Als

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

2008-08-26 Thread Pierre Gaston
On Tue, Aug 26, 2008 at 5:41 AM, R. Bernstein <[EMAIL PROTECTED]> 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 > >

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

2008-08-26 Thread R. Bernstein
Pierre Gaston writes: > On Tue, Aug 26, 2008 at 5:41 AM, R. Bernstein <[EMAIL PROTECTED]> 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

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

2008-08-26 Thread Pierre Gaston
On Tue, Aug 26, 2008 at 4:49 PM, R. Bernstein <[EMAIL PROTECTED]> wrote: > Pierre Gaston writes: > > On Tue, Aug 26, 2008 at 5:41 AM, R. Bernstein <[EMAIL PROTECTED]> wrote: > > > Both zsh and ksh have a way to open a file or duplicate a file > > > descriptor and let the interpreter pick the des

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

2008-08-26 Thread Dave B
Pierre Gaston wrote: >> > On Tue, Aug 26, 2008 at 5:41 AM, R. Bernstein <[EMAIL PROTECTED]> 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 v

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

2008-08-26 Thread Pierre Gaston
On Tue, Aug 26, 2008 at 5:33 PM, Dave B <[EMAIL PROTECTED]> wrote: > Pierre Gaston wrote: > >>> > On Tue, Aug 26, 2008 at 5:41 AM, R. Bernstein <[EMAIL PROTECTED]> wrote: >>> > > Both zsh and ksh have a way to open a file or duplicate a file >>> > > descriptor and let the interpreter pick the de

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

2008-08-26 Thread R. Bernstein
Pierre Gaston writes: > On Tue, Aug 26, 2008 at 4:49 PM, R. Bernstein <[EMAIL PROTECTED]> wrote: > > Pierre Gaston writes: > > > On Tue, Aug 26, 2008 at 5:41 AM, R. Bernstein <[EMAIL PROTECTED]> wrote: > > > > Both zsh and ksh have a way to open a file or duplicate a file > > > > descriptor

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

2008-08-26 Thread Pierre Gaston
On Tue, Aug 26, 2008 at 5:38 PM, R. Bernstein <[EMAIL PROTECTED]> wrote: > Pierre Gaston writes: > > On Tue, Aug 26, 2008 at 4:49 PM, R. Bernstein <[EMAIL PROTECTED]> wrote: > > > Pierre Gaston writes: > > > > On Tue, Aug 26, 2008 at 5:41 AM, R. Bernstein <[EMAIL PROTECTED]> > wrote: > > > >

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

2008-08-26 Thread Dave B
Pierre Gaston wrote: >> I think he refers to the fact that, with ksh, you can do for instance >> >> $ exec {fd}<&0 >> $ echo $fd >> 10 >> $ exec {fd1}<&0 >> $ echo $fd1 >> 11 >> >> I didn't try on zsh, but with bash you get: >> >> $ exec {fd}<&0 >> -bash: exec: {fd}: not found >> > ah sorry I didn

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

2008-08-26 Thread Chet Ramey
R. Bernstein 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

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

2008-08-26 Thread R. Bernstein
Chet Ramey writes: > R. Bernstein 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 d

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

2008-08-26 Thread Chet Ramey
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

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

2008-08-26 Thread R. Bernstein
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

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

2008-08-26 Thread Chet Ramey
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 >

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

2008-08-26 Thread R. Bernstein
Chet Ramey writes: > > Redirections using file descriptors greater than 9 should be used with > > care, as they may conflict with file descriptors the shell uses > > internally. ... > The sentence is more a caution about the previously-mentioned clexec bugs. > As a practical matter, you