On 2/1/22 10:23 AM, Chet Ramey wrote:

If you defer alias expansion until execution, you lose the (posix-
encouraged but officially unspecified according to the approved
interpretation of issue 1342) ability to have aliases affect command
parsing in the command substitution:

Well, I went back and read the entire interpretation. The part that's not
specified is whether an alias expansion provides the closing `)', but alias
expansion has to be performed while parsing the contents of the command
substitution:

"existing aliases are required to be expanded when the shell parses the
input that follows the "$(" in order to find the terminating ')'"

and (in the same interpretation):

"Historically some shells used simple parenthesis counting to find the
terminating ')' and therefore did not account for aliases. However, such
shells never conformed to POSIX, which has always required recursive
parsing (see XCU 2.3 item 5)."

So this seems like behavior that should be conditional on posix mode to
preserve backwards compatibility.

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

Reply via email to