[lug] Process substitution.
blug-mail at duboulder.com
Sun Sep 19 15:15:40 MDT 2010
On 09/19/10 10:41, David L. Anselmi wrote:
> I've recently found some uses for bash's process substitution (didn't think I would but what do I
> know?) But it seems hard to tell whether it will work or not for different programs. Does anyone
> know why some don't work?
> For example, if I have programs a and b and I want to compare their output, these lines do the same
> diff <(a) <(b)
> a > a.txt ; b > b.txt ; diff a.txt b.txt
> But logrotate doesn't work like diff. It takes a config file as an argument but won't read this:
> logrotate <(# code to generate config file here)
Assuming you are using bash, the process substitution section says it is using fifos. So
your diff example above is not exactly equivalent. Can your config generating command
tolerate being connected to fifos (which have different blocking behavior than files)?
> I plan to look at the source, but maybe someone already knows.
> BTW, in zsh you can do <(), which uses a FIFO, or you can do =(), which uses a file. I expect
> logrotate would work fine with the =() form. But I don't have zsh where I've tried to use this.
> Web Page: http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: irc.hackingsociety.org port=6667 channel=#hackingsociety
More information about the LUG