On Mon, May 18, 2015 at 10:26 PM, Chet Ramey <chet.ra...@case.edu> wrote:
> On 5/16/15 1:11 PM, marz...@gmail.com wrote: > > > Bash Version: 4.3 > > Patch Level: 30 > > Release Status: release > > > > Description: > > from interactive shell running cat < <(read -r var) prints: > > bash: read: read error: 0: Input/output error > > > > on the other hand: > > (read -r var) reads chars from terminal stdin > > > > > > Repeat-By: > > cat < <(read var) > > I'm not sure what the question is here. The two constructs are totally > different in effect and implementation. The error comes because the > process substitution is run asynchronously, in the same process group as > the calling shell (though exactly which pgrp doesn't matter), and the > `cat' process runs in a different process group and `owns' the terminal. > > In the second (subshell) example, none of these things is true. > > -- > ``The lyf so short, the craft so long to lerne.'' - Chaucer > ``Ars longa, vita brevis'' - Hippocrates > Chet Ramey, ITS, CWRU c...@case.edu > http://cnswww.cns.cwru.edu/~chet/ > > The question really is (I discussed this with him on IRC) why can you do: $ cat <(read var </dev/tty;echo $var) blah blah but not: $ cat < <(read var </dev/tty;echo $var) bash: read: read error: 0: Input/output error