bug-bash
[Top][All Lists]
Advanced

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

Re: Possible bug when combining Bash's process substitution with HERE-do


From: Dan Douglas
Subject: Re: Possible bug when combining Bash's process substitution with HERE-document?
Date: Wed, 18 Jun 2014 07:56:35 -0500

I've heard process substitutions considerably complicate parsing. zsh
and ksh93 are the only others that have process substitutions that I
know of, and zsh can't handle unbalanced parentheses in that situation
either.

 $ zsh -c $'cat <(cat <<"EOF"\n(test)(foo\nEOF\n)'
zsh:4: parse error near `<(cat <<"EOF"'
 $ ksh -c $'cat <(cat <<"EOF"\n(test)(foo\nEOF\n)'
(test)(foo

This is probably the most directly equivalent workaround:

 $ { cat <(cat) <&3-; } 3<&0 <<<'(test)(foo'
(test)(foo

Identical logic except the procsub inherits the heredoc FD from its
parent. The inner cat still gets the heredoc and the outer cat gets
the original stdin, but dodges needing the nested heredoc.

On Tue, Jun 17, 2014 at 4:54 PM, Tim Friske <me@timfriske.com> wrote:
> Hi,
>
> see my question
> http://unix.stackexchange.com/questions/137506/how-to-combine-bashs-process-substitution-with-here-document
> for a description.
>
> Could the described behavior be a bug?
>
> Kind regards
> Tim
>



reply via email to

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