Hi list.
Want to read whole stdin into variable.
Don't want to spawn new processes (cat).
Don't want to reopen existing fd &0
First thing I tried: $(<&0)
It silently returns an empty string.
From bash manual:
The command substitution $(cat file) can be replaced by the equivalent but
faster
On Wed, Jul 01, 2015 at 10:19:10PM +0300, Ilya Basin wrote:
> Want to read whole stdin into variable.
> Don't want to spawn new processes (cat).
If the data stream does not contain any NUL bytes, you can use:
IFS= read -r -d '' variable
On Wed, Jul 01, 2015 at 10:19:10PM +0300, Ilya Basin wrote:
> Hi list.
>
> Want to read whole stdin into variable.
> Don't want to spawn new processes (cat).
> Don't want to reopen existing fd &0
>
> First thing I tried: $(<&0)
> It silently returns an empty string.
This type of query is prefera
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
$(&3), it doesn't work in ksh either, (in ksh, like in bash,
$(
SC> 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).
SC> [...]
SC> Note that
SC> $( execute /bin/cat in that process, it does the reading (from
SC> file) and writing (to the pipe) by itself (and the paren
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
>
> $( execute /bin/cat in that process, it does the reading (from
> file) and writing (