[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Why `$(<` is slow?
From: |
Peng Yu |
Subject: |
Re: [Help-bash] Why `$(<` is slow? |
Date: |
Fri, 30 Aug 2019 21:27:32 -0500 |
On 8/30/19, Chet Ramey <address@hidden> wrote:
> 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.
Could you consider removing the overhead to make $(< lightweight like
many other shells? Thanks.
--
Regards,
Peng