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: Sun, 1 Sep 2019 15:58:12 -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 1:56 PM, Stephane Chazelas wrote:

> OK, but:
> 
> bash-5.0$ echo "$(<file
> # comment
> )"
> 
> bash-5.0$ echo $(< file
> 
> )
> 
> 
> The $(<file) seems not to be recognised as the $(<file) operator
> in the last two cases which seems a bit inconsistent.

$(< isn't an operator, per se. The semantics are command-based: the
contents of the command substitution have to parse to a simple command that
consists of a single redirection and consumes the entire command
substitution. Bash doesn't do greedy parsing that consumes trailing
comments or newlines; it parses a single command and then checks.

-- 
``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]