[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: substitution "read all from fd" silently fails: $(<&0)
From: |
Pádraig Brady |
Subject: |
Re: substitution "read all from fd" silently fails: $(<&0) |
Date: |
Thu, 02 Jul 2015 04:27:35 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 |
On 01/07/15 22:48, Stephane Chazelas wrote:
> 2015-07-01 22:19:10 +0300, Ilya Basin:
>> Hi list.
>>
>> Want to read whole stdin into variable.
>> Don't want to spawn new processes (cat).
> [...]
>
> Note that
>
> $(<file) does spawn a new process, it's just that bash doesn't
> execute /bin/cat in that process, it does the reading (from
> file) and writing (to the pipe) by itself (and the parent reads
> from the other end of the pipe to make-up the substitution).
>
> ksh (ksh93 and mksh) and zsh do not spawn a process in the
> $(<file) case.
For completeness dash ignores this format so it's quite non portable