bug-bash
[Top][All Lists]
Advanced

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

Re: process substitution and trailing file descriptors


From: Ian
Subject: Re: process substitution and trailing file descriptors
Date: Fri, 12 Feb 2010 02:54:19 -0800 (PST)
User-agent: G2/1.0

On 11 Feb, 20:29, Greg Wooledge <wool...@eeg.ccf.org> wrote:
> When the shortcuts are too short, you need to fall back to the original
> tools.  In this case, >() is really just a shortcut for "create a FIFO,
> and open it".  Doing so by hand should give you the manual control you
> need.  At the very least, you can tell bash which FD number to use when
> you open the FIFO.

 Thanks, Greg.  I'd simply not thought of doing the heavy lifting
myself.

 I'd realised afterwards that any soft of close on exec would be
fraught with pain as in the /dev/fd/n case, the files you might be
giving to diff, as in

diff <(sort a) <(sort b)

 would be deleting the /dev/fd/n that diff was about to open.


 I think I was hoping that there might be some magic with the
redirection operators that might recognise that the word in

 >word

 was a process substitution fifo and therefore the high numbered file
descriptor created temporarily for the fifo could be closed.  There's
probably a perfectly reasonable case where the process substitution
fifo on the RHS of an IO redirection operator should not be closed.

Cheers,

Ian



reply via email to

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