help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] Why `$(<` is slow?


From: Chet Ramey
Subject: Re: [Help-bash] Why `$(<` is slow?
Date: Fri, 30 Aug 2019 09:51:08 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

On 8/30/19 8:32 AM, Greg Wooledge wrote:
> On Fri, Aug 30, 2019 at 07:50:55AM +0100, Stephane Chazelas wrote:
>> In bash, $(<qwe) still creates a pipe, forks a child process
>> that reads from the file, writes to the pipes, while the parent
>> read from the other end of the pipe. The only thing that is
>> optimised away is the execution of "cat".
> 
> Oh.  That's interesting... good to know.

Bash parses the command and makes sure it's a valid redirection instead
of doing it lexically. That happens in the subshell just like any other
command substitution.


-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    address@hidden    http://tiswww.cwru.edu/~chet/



reply via email to

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