[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Incorrect alias expansion within command substitution
From: |
Alex fxmbsw7 Ratchev |
Subject: |
Re: Incorrect alias expansion within command substitution |
Date: |
Tue, 1 Feb 2022 19:29:19 +0100 |
On Tue, Feb 1, 2022, 19:25 Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com> wrote:
> you'd expand an alias if seen and then reinterpret the whats gotten also
> to ( possible ) current cmdline before alias
>
as with multiple heredocs in complex cmds
{
cmd "$( < /dev/fd/4 )" "$( < /dev/fd/3 )"
} 4<<eo 3<<eo
bla
eo
two
eo
all works
the closing ) alias is same code, it would look funky to use such, till
gotten uses to it
no aliases or closing aliaes containing, regarding that i can stick if and
fi and stuff together makes absolutley no sense
my last penny, for weed, and proper aliases
>
> its hard to limit this to one cmd per chunk only
>
> you, 1. expand alias 2. it expanded to multiple complex cmds 3. bash
> parses the resulting text and does its per cmd recieved works
>
> On Tue, Feb 1, 2022, 19:22 Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com> wrote:
>
>>
>>
>> On Tue, Feb 1, 2022, 19:16 Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com>
>> wrote:
>>
>>>
>>>
>>> On Tue, Feb 1, 2022, 19:11 Chet Ramey <chet.ramey@case.edu> wrote:
>>>
>>>> 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 ')'"
>>>>
>>>
>>> i see here only possible ) closing parsing, not doing so results in a
>>> mess
>>>
>>
>> if, there is a closing loose ) in the alias, i assume its for usage there
>> non legit cases are the invalid coded ones ( the 'wouldnt work anyway
>> cause wrong know )
>>
>>>
>>> for me, aliases as im bash ive experienced as text inplace replacements,
>>> flat text, then the cmdline parsing is done, so closing ) if easily
>>> specified by user yes works, else broken incomplete ( wrong pathed ) aliases
>>>
>>>>
>>>> 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 chet@case.edu
>>>> http://tiswww.cwru.edu/~chet/
>>>>
>>>>
Message not available
- Re: Incorrect alias expansion within command substitution, Robert Elz, 2022/02/01
- Re: Incorrect alias expansion within command substitution, Chet Ramey, 2022/02/01
- Re: Incorrect alias expansion within command substitution, Robert Elz, 2022/02/01
- Re: Incorrect alias expansion within command substitution, Chet Ramey, 2022/02/02
- Re: Incorrect alias expansion within command substitution, Robert Elz, 2022/02/02
- Re: Incorrect alias expansion within command substitution, Chet Ramey, 2022/02/03
- Re: Incorrect alias expansion within command substitution, Alex fxmbsw7 Ratchev, 2022/02/03
- Re: Incorrect alias expansion within command substitution, Alex fxmbsw7 Ratchev, 2022/02/03