[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (read -r var) vs <(read -r var) behavior
From: |
Chet Ramey |
Subject: |
Re: (read -r var) vs <(read -r var) behavior |
Date: |
Tue, 19 May 2015 21:12:55 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 |
On 5/19/15 1:42 AM, Pierre Gaston wrote:
> 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
I'm not sure where you can do this; I get EIO for both constructs on Mac
OS X, Fedora 21, RHEL 6, and Solaris 11 (what I happened to have available
today).
The kernel returns -1/EIO because the shell started to run the process
substitution is ignoring SIGTTIN and the process attempts to read
from its controlling terminal (/dev/tty) while the terminal's process
group is set to different process group (making that shell a background
process group).
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/