[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Command substitution before while loop
From: |
Chet Ramey |
Subject: |
Re: Command substitution before while loop |
Date: |
Wed, 1 Apr 2020 14:20:32 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 |
On 4/1/20 1:47 PM, Andreas Schwab wrote:
> On Apr 01 2020, Krystian Wojtas via Bug reports for the GNU Bourne Again
> SHell wrote:
>
>> Making comments in pipes using command substitution is very helpful.
>> But there is syntax error it it is done just before while loop. Could it be
>> considered as bug?
>
> Not a bug. Reserved words are only recognized at the start of a
> command, before any expansions. For the same reason a compound command
> cannot be preceded by redirections.
Yes, and also please note that the historical `` form of command
substitution isn't guaranteed to be able to parse arbitrary commands.
Use $(...) for that.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/