Re: substitution read all from fd silently fails: $(0)

2015-07-02 Thread Stephane Chazelas
2015-07-02 04:27:35 +0100, Pádraig Brady: [...] $(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 read all from fd silently fails: $(0)

2015-07-01 Thread Ilya Basin
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 $(

Re: substitution read all from fd silently fails: $(0)

2015-07-01 Thread Geir Hauge
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 preferably asked

Re: substitution read all from fd silently fails: $(0)

2015-07-01 Thread Stephane Chazelas
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

Re: substitution read all from fd silently fails: $(0)

2015-07-01 Thread Pádraig Brady
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,