[Top][All Lists]

[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: Mon, 18 May 2015 15:26:43 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

On 5/16/15 1:11 PM, address@hidden 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    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

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