help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] Why `echo !(*.l).c` behaves different depending on the c


From: Chet Ramey
Subject: Re: [Help-bash] Why `echo !(*.l).c` behaves different depending on the context?
Date: Mon, 11 Feb 2019 11:46:50 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.5.0

On 2/11/19 11:34 AM, Peng Yu wrote:
>> How would you propose to "improve it" given the requirement that compound
>> commands are parsed in their entirety before any part is executed?
> 
> I am still learning the grammar file. But why the compound commands
> have to be parsed in their entirety? If each individual command in a
> compound command is run one by one anyway in the backend, there is not
> the reason why the frontend cannot parse each command one by one
> instead of as a whole.

This makes no sense at all. Whether or not the shell parses each command
in, say, the body of a compound command one at a time (it does, but they
are all part of the same command list), it cannot execute any of them until
the entire compound command is parsed successfully. Would you want the
test in an if statement to be executed, and commands executed on the fly
as they are encountered, without a trailing `fi'?

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