Re: Incorrect alias expansion within command substitution

2022-02-05 Thread Alex fxmbsw7 Ratchev
yea sorry i accept it doesnt work .. On Sat, Feb 5, 2022, 22:31 Chet Ramey wrote: > On 2/5/22 3:54 PM, Alex fxmbsw7 Ratchev wrote: > > it would make the whole work at alias level > > alias (symbolic) 1=$(( 2=1+2 3=+ 4=1+2 5=)) > > 1 2 3 4 5 > > works > > [i wish] > > We need an intervention

Re: Incorrect alias expansion within command substitution

2022-02-05 Thread Chet Ramey
On 2/5/22 3:54 PM, Alex fxmbsw7 Ratchev wrote: it would make the whole work at alias level alias (symbolic) 1=$(( 2=1+2 3=+ 4=1+2 5=)) 1 2 3 4 5 works [i wish] We need an intervention here. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita

Re: Incorrect alias expansion within command substitution

2022-02-05 Thread Lawrence Velázquez
> On Sat, Feb 5, 2022 at 9:46 PM Chet Ramey wrote: >> >> On 2/5/22 3:44 PM, Alex fxmbsw7 Ratchev wrote: >> > maybe ask about an shopt feature to enable straight alias expansion >> > when the aliases are following .. >> >> How would that, whatever it is, help you here? I think he wants an option

Re: Incorrect alias expansion within command substitution

2022-02-05 Thread Alex fxmbsw7 Ratchev
meant in more reasonable complicated codes they are more useufl On Sat, Feb 5, 2022 at 9:54 PM Alex fxmbsw7 Ratchev wrote: > > it would make the whole work at alias level > alias (symbolic) 1=$(( 2=1+2 3=+ 4=1+2 5=)) > 1 2 3 4 5 > works > [i wish] > > On Sat, Feb 5, 2022 at 9:46 PM Chet Ramey

Re: Incorrect alias expansion within command substitution

2022-02-05 Thread Alex fxmbsw7 Ratchev
it would make the whole work at alias level alias (symbolic) 1=$(( 2=1+2 3=+ 4=1+2 5=)) 1 2 3 4 5 works [i wish] On Sat, Feb 5, 2022 at 9:46 PM Chet Ramey wrote: > > On 2/5/22 3:44 PM, Alex fxmbsw7 Ratchev wrote: > > On Sat, Feb 5, 2022 at 9:39 PM Alex fxmbsw7 Ratchev > > wrote: > >> > >> On

Re: Incorrect alias expansion within command substitution

2022-02-05 Thread Chet Ramey
On 2/5/22 3:44 PM, Alex fxmbsw7 Ratchev wrote: On Sat, Feb 5, 2022 at 9:39 PM Alex fxmbsw7 Ratchev wrote: On Sat, Feb 5, 2022 at 7:55 PM Chet Ramey wrote: On 2/4/22 6:17 PM, Alex fxmbsw7 Ratchev wrote: what about this viewing point aliases can start, $(('s, but not end... this is unlogic

Re: Incorrect alias expansion within command substitution

2022-02-05 Thread Alex fxmbsw7 Ratchev
On Sat, Feb 5, 2022 at 9:39 PM Alex fxmbsw7 Ratchev wrote: > > On Sat, Feb 5, 2022 at 7:55 PM Chet Ramey wrote: > > > > On 2/4/22 6:17 PM, Alex fxmbsw7 Ratchev wrote: > > > what about this viewing point > > > aliases can start, $(('s, but not end... this is unlogic > > > > Well, I don't know

Re: Incorrect alias expansion within command substitution

2022-02-05 Thread Alex fxmbsw7 Ratchev
On Sat, Feb 5, 2022 at 7:55 PM Chet Ramey wrote: > > On 2/4/22 6:17 PM, Alex fxmbsw7 Ratchev wrote: > > what about this viewing point > > aliases can start, $(('s, but not end... this is unlogic > > Well, I don't know about `unlogic' but there's an understanding deficit, > for sure. > > > > >

Re: Incorrect alias expansion within command substitution

2022-02-05 Thread Chet Ramey
On 2/4/22 6:21 PM, Alex fxmbsw7 Ratchev wrote: it seems me here the data was used as var inside $(( not as alias That, at least, is right. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU

Re: Incorrect alias expansion within command substitution

2022-02-05 Thread Chet Ramey
On 2/4/22 6:17 PM, Alex fxmbsw7 Ratchev wrote: what about this viewing point aliases can start, $(('s, but not end... this is unlogic Well, I don't know about `unlogic' but there's an understanding deficit, for sure. alias -- \ p='printf %s\\n ' \ assign='assign=$(( ' begin='$(( ' \ for

Re: Incorrect alias expansion within command substitution

2022-02-05 Thread Chet Ramey
On 2/4/22 4:59 PM, Alex fxmbsw7 Ratchev wrote: On Fri, Feb 4, 2022 at 10:18 PM Robert Elz wrote: Date:Fri, 4 Feb 2022 21:06:11 +0100 From:Alex fxmbsw7 Ratchev Message-ID: | now changing this to dynamic eof marker There is no such thing. Unlikely

Re: Incorrect alias expansion within command substitution

2022-02-05 Thread Chet Ramey
On 2/4/22 3:06 PM, Alex fxmbsw7 Ratchev wrote: it was my mind shell does it mean it wont ever get to be the regex /<<([^ \t\f\v\r\n;]+) that is, after << is parsed a read word till next space, no shell expansion logic of separated functional structures in the topic of flat data is overruling,

Re: Incorrect alias expansion within command substitution

2022-02-04 Thread Alex fxmbsw7 Ratchev
it seems me here the data was used as var inside $(( not as alias i tried d1 d2 d3 combination and didnt work On Sat, Feb 5, 2022 at 12:17 AM Alex fxmbsw7 Ratchev wrote: > > what about this viewing point > aliases can start, $(('s, but not end... this is unlogic > > alias -- \ > p='printf %s\\n

Re: Incorrect alias expansion within command substitution

2022-02-04 Thread Alex fxmbsw7 Ratchev
what about this viewing point aliases can start, $(('s, but not end... this is unlogic alias -- \ p='printf %s\\n ' \ assign='assign=$(( ' begin='$(( ' \ for data in "1 + 2" do alias -- data="$d " p begin data )) done this works and results 3 its just, early bugs, unlogic :) On Sat, Feb 5,

Re: Incorrect alias expansion within command substitution

2022-02-04 Thread Alex fxmbsw7 Ratchev
On Fri, Feb 4, 2022, 23:12 Chet Ramey wrote: > On 2/4/22 2:56 PM, Alex fxmbsw7 Ratchev wrote: > > >>> by flat non lexical text parsing, excepts for quotes but then $( > logically > >>> expands, excepts: > >>> but imho the topic here is how far to expand shell stuff at this > position, > >>>

Re: Incorrect alias expansion within command substitution

2022-02-04 Thread Chet Ramey
On 2/4/22 2:56 PM, Alex fxmbsw7 Ratchev wrote: by flat non lexical text parsing, excepts for quotes but then $( logically expands, excepts: but imho the topic here is how far to expand shell stuff at this position, however factically its just needs to be a constant data separator Well, you'd

Re: Incorrect alias expansion within command substitution

2022-02-04 Thread Alex fxmbsw7 Ratchev
On Fri, Feb 4, 2022 at 10:18 PM Robert Elz wrote: > > Date:Fri, 4 Feb 2022 21:06:11 +0100 > From:Alex fxmbsw7 Ratchev > Message-ID: > > > > | now changing this to dynamic eof marker > > There is no such thing. Unlikely (*VERY* unlikely) there ever will be. > >

Re: Incorrect alias expansion within command substitution

2022-02-04 Thread Robert Elz
Date:Fri, 4 Feb 2022 21:06:11 +0100 From:Alex fxmbsw7 Ratchev Message-ID: | now changing this to dynamic eof marker There is no such thing. Unlikely (*VERY* unlikely) there ever will be. | cat <<$( printf leet ) | $( printf leet ) | $( printf leet )

Re: Incorrect alias expansion within command substitution

2022-02-04 Thread Alex fxmbsw7 Ratchev
On Fri, Feb 4, 2022 at 8:56 PM Alex fxmbsw7 Ratchev wrote: > > On Fri, Feb 4, 2022 at 8:28 PM Chet Ramey wrote: > > > > On 2/4/22 2:23 PM, Alex fxmbsw7 Ratchev wrote: > > > > > > imho the example above should have resulted in error ')' > > > > it would execute cat a b ) with hello till

Re: Incorrect alias expansion within command substitution

2022-02-04 Thread Alex fxmbsw7 Ratchev
On Fri, Feb 4, 2022 at 8:28 PM Chet Ramey wrote: > > On 2/4/22 2:23 PM, Alex fxmbsw7 Ratchev wrote: > > > > imho the example above should have resulted in error ')' > > > it would execute cat a b ) with hello till $( then rather \n and a b > > ) > > > again, useless > > >

Re: Incorrect alias expansion within command substitution

2022-02-04 Thread Alex fxmbsw7 Ratchev
On Fri, Feb 4, 2022, 20:18 Chet Ramey wrote: > On 2/3/22 9:46 PM, Alex fxmbsw7 Ratchev wrote: > > > The case I had in question with the question about $( a b ) was this > > one... > > > > cat <<$( a b ) > > hello > > $( a b ) > > > > > > i think you

Re: Incorrect alias expansion within command substitution

2022-02-04 Thread Chet Ramey
On 2/3/22 9:46 PM, Alex fxmbsw7 Ratchev wrote: The case I had in question with the question about $( a b ) was this one...         cat <<$( a b )         hello         $( a b ) i think you are mis understanding the differencies here between shell expression parsing,

Re: Incorrect alias expansion within command substitution

2022-02-04 Thread Chet Ramey
On 2/3/22 4:20 PM, Robert Elz wrote: | and it's just | as clear that, let's say, implementations differ in this area. Aside from bash 5.2, not really. There are lots of implementation bugs are limitations, but not really any expectation that the here doc end word text can be modified

Re: Incorrect alias expansion within command substitution

2022-02-04 Thread Chet Ramey
On 2/4/22 2:23 PM, Alex fxmbsw7 Ratchev wrote: > imho the example above should have resulted in error ')' > it would execute cat a b ) with hello till $( then rather \n and a b ) > again, useless > especially the $( wasnt even quoted What can this possibly mean? What

Re: Incorrect alias expansion within command substitution

2022-02-03 Thread Alex fxmbsw7 Ratchev
On Wed, Feb 2, 2022, 20:43 Robert Elz wrote: > Date:Wed, 2 Feb 2022 11:38:30 -0500 > From:Chet Ramey > Message-ID: <7c422cbb-bba8-0a57-a565-eeb115120...@case.edu> > > > | > How accurately can you reconstitute? That is, can you maintain the > | > difference

Re: Incorrect alias expansion within command substitution

2022-02-03 Thread Chet Ramey
On 2/3/22 3:23 PM, L A Walsh wrote:    In a similar way when one does a 'read var < fn' and you decide to add a warning if 'fn' ended with a binary '0', that would be fine if it only affected you, but you added the warning claiming it was solving some problem complained about by some users.

Re: Incorrect alias expansion within command substitution

2022-02-03 Thread Chet Ramey
On 2/3/22 5:25 PM, Robert Elz wrote: Date:Thu, 3 Feb 2022 16:19:08 -0500 From:Greg Wooledge Message-ID: | This declares the variables at the wrong scope. You are correct - I never normally use "declare" for anything, so I had forgotten that it was

Re: Incorrect alias expansion within command substitution

2022-02-03 Thread Robert Elz
Date:Thu, 3 Feb 2022 16:19:08 -0500 From:Greg Wooledge Message-ID: | This declares the variables at the wrong scope. You are correct - I never normally use "declare" for anything, so I had forgotten that it was essentially a clone of "local" (rather than "local"

Re: Incorrect alias expansion within command substitution

2022-02-03 Thread Chet Ramey
On 2/3/22 4:14 PM, Alex fxmbsw7 Ratchev wrote: alias 0='echo ' 1='$(( ' 2=')) ' data=2+3' ' thats why this doesnt work, or what 0 1 data 2 Come on. This expands to four words: echo $(( 2+3 )) that is not the arithmetic expansion you thought you were looking for. -- ``The lyf so short,

Re: Incorrect alias expansion within command substitution

2022-02-03 Thread Alex fxmbsw7 Ratchev
On Thu, Feb 3, 2022, 20:02 Chet Ramey wrote: > On 2/2/22 1:30 PM, Robert Elz wrote: > > Date:Wed, 2 Feb 2022 11:38:30 -0500 > > From:Chet Ramey > > Message-ID: <7c422cbb-bba8-0a57-a565-eeb115120...@case.edu> > > > > > >| > How accurately can you reconstitute?

Re: Incorrect alias expansion within command substitution

2022-02-03 Thread Alex fxmbsw7 Ratchev
btw u just need a two teee's there one l.int local int ome g.int for with -g and the setting for non g may not be a function On Thu, Feb 3, 2022, 22:28 L A Walsh wrote: > > > On 2022/02/03 11:02, Chet Ramey wrote: > > On 2/2/22 10:18 PM, Robert Elz wrote: > > > >> Date:Wed, 02 Feb

Re: Incorrect alias expansion within command substitution

2022-02-03 Thread Alex fxmbsw7 Ratchev
On Thu, Feb 3, 2022, 22:14 Alex fxmbsw7 Ratchev wrote: > > > On Thu, Feb 3, 2022, 20:02 Chet Ramey wrote: > >> On 2/2/22 1:30 PM, Robert Elz wrote: >> > Date:Wed, 2 Feb 2022 11:38:30 -0500 >> > From:Chet Ramey >> > Message-ID:

Re: Incorrect alias expansion within command substitution

2022-02-03 Thread L A Walsh
On 2022/02/03 11:02, Chet Ramey wrote: On 2/2/22 10:18 PM, Robert Elz wrote: Date:Wed, 02 Feb 2022 17:18:08 -0800 From:L A Walsh Message-ID: <61fb2d50.7010...@tlinx.org> | My posix non-conformance issue has to do with bash not starting with |

Re: Incorrect alias expansion within command substitution

2022-02-03 Thread Robert Elz
Date:Thu, 3 Feb 2022 13:31:52 -0500 From:Chet Ramey Message-ID: <46753625-7fcc-8296-c31e-7a5d1fc38...@case.edu> | My argument is like yours -- is there a return on the investment of effort | to make it worth doing, if the current state preserves semantics? Sure,

Re: Incorrect alias expansion within command substitution

2022-02-03 Thread Greg Wooledge
On Fri, Feb 04, 2022 at 02:52:34AM +0700, Robert Elz wrote: > You could instead use: > > my() > { > local A= > while [ $# -gt 0 ] > do > case "$1" in > int)A="${A} -i";; >

Re: Incorrect alias expansion within command substitution

2022-02-03 Thread Robert Elz
Date:Thu, 03 Feb 2022 09:05:53 -0800 From:L A Walsh Message-ID: <61fc0b71.2080...@tlinx.org> | There is no way you can tell me that: | declare var='v' | declare -i ivar=1 | | are more clear than: | | my var='v' | int ivar=1 I can, easily -- for the

Re: Incorrect alias expansion within command substitution

2022-02-03 Thread Chet Ramey
On 2/2/22 10:18 PM, Robert Elz wrote: Date:Wed, 02 Feb 2022 17:18:08 -0800 From:L A Walsh Message-ID: <61fb2d50.7010...@tlinx.org> | My posix non-conformance issue has to do with bash not starting with | aliases enabled by default in all default

Re: Incorrect alias expansion within command substitution

2022-02-03 Thread Chet Ramey
On 2/2/22 8:18 PM, L A Walsh wrote: However w/r/t starting with aliases being enabled by default when bash starts (interactive or not), I would prefer bash follow posix rules. You have a preference that can easily be satisfied by running bash with the appropriate option enabled. It's not a

Re: Incorrect alias expansion within command substitution

2022-02-03 Thread Chet Ramey
On 2/3/22 12:05 PM, L A Walsh wrote:     There's no need for it, it just makes your script harder to     follow. ---    I write scripts for myself.  aliases make scriptes easier to create modify and maintain.  You can type 'declare -i x=1', I prefer 'int x=1' I find 'declare -xxyz' harder to

Re: Incorrect alias expansion within command substitution

2022-02-03 Thread Chet Ramey
On 2/2/22 1:30 PM, Robert Elz wrote: Date:Wed, 2 Feb 2022 11:38:30 -0500 From:Chet Ramey Message-ID: <7c422cbb-bba8-0a57-a565-eeb115120...@case.edu> | > How accurately can you reconstitute? That is, can you maintain the | > difference between $(a b) and

Re: Incorrect alias expansion within command substitution

2022-02-03 Thread Alex fxmbsw7 Ratchev
On Thu, Feb 3, 2022, 18:16 Dennis Williamson wrote: > > > On Thu, Feb 3, 2022, 11:14 AM Alex fxmbsw7 Ratchev > wrote: > >> aliases are the way not to write duplicate code >> >> > > > No, functions are. > im your dreams.. >

Re: Incorrect alias expansion within command substitution

2022-02-03 Thread Dennis Williamson
On Thu, Feb 3, 2022, 11:14 AM Alex fxmbsw7 Ratchev wrote: > aliases are the way not to write duplicate code > > No, functions are. >

Re: Incorrect alias expansion within command substitution

2022-02-03 Thread L A Walsh
On 2022/02/03 07:02, Alex fxmbsw7 Ratchev wrote: On Thu, Feb 3, 2022, 04:20 Robert Elz > wrote: Date:Wed, 02 Feb 2022 17:18:08 -0800 From:L A Walsh mailto:b...@tlinx.org>> Message-ID: <61fb2d50.7010...@tlinx.org

Re: Incorrect alias expansion within command substitution

2022-02-03 Thread Alex fxmbsw7 Ratchev
aliases are the way not to write duplicate code On Thu, Feb 3, 2022, 18:06 L A Walsh wrote: > > > On 2022/02/03 07:02, Alex fxmbsw7 Ratchev wrote: > > > > > > On Thu, Feb 3, 2022, 04:20 Robert Elz > > wrote: > > > > Date:Wed, 02 Feb 2022 17:18:08

Re: Incorrect alias expansion within command substitution

2022-02-03 Thread Alex fxmbsw7 Ratchev
On Thu, Feb 3, 2022, 04:20 Robert Elz wrote: > Date:Wed, 02 Feb 2022 17:18:08 -0800 > From:L A Walsh > Message-ID: <61fb2d50.7010...@tlinx.org> > > | My posix non-conformance issue has to do with bash not starting with > | aliases enabled by default in all

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread Robert Elz
Date:Wed, 02 Feb 2022 17:18:08 -0800 From:L A Walsh Message-ID: <61fb2d50.7010...@tlinx.org> | My posix non-conformance issue has to do with bash not starting with | aliases enabled by default in all default invocations. If you're using aliases in scripts, then

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread Alex fxmbsw7 Ratchev
i see only two solutions as an option one option does expand aliases inside safe out of the tree the other more eval ing On Thu, Feb 3, 2022, 02:27 L A Walsh wrote: > > > On 2022/02/02 08:50, Chet Ramey wrote: > > On 2/2/22 8:25 AM, L A Walsh wrote: > > > > > >> I.e. My bash is posix compliant

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread L A Walsh
On 2022/02/02 08:50, Chet Ramey wrote: On 2/2/22 8:25 AM, L A Walsh wrote: I.e. My bash is posix compliant by default w/r/t aliases: It's not, and that's how this whole issue got started. You're running bash-4.4. POSIX requires the following to work: alias switch=case echo

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread Alex fxmbsw7 Ratchev
On Wed, Feb 2, 2022, 21:59 Chet Ramey wrote: > On 2/2/22 1:40 PM, Martijn Dekker wrote: > > Op 01-02-22 om 15:23 schreef Chet Ramey: > >> Historically, bash (and ksh93) has favored the former. Just about all > the > >> other shells claiming some sort of POSIX conformance favor the latter > (all

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread Chet Ramey
On 2/2/22 1:40 PM, Martijn Dekker wrote: > Op 01-02-22 om 15:23 schreef Chet Ramey: >> Historically, bash (and ksh93) has favored the former. Just about all the >> other shells claiming some sort of POSIX conformance favor the latter (all >> the ash-based shells, yash, mksh). >> >> What are your

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread Chet Ramey
On 2/2/22 11:14 AM, L A Walsh wrote: > On 2022/02/01 07:50, Chet Ramey wrote: >> >> >> "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

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread Robert Elz
Date:Wed, 2 Feb 2022 11:38:30 -0500 From:Chet Ramey Message-ID: <7c422cbb-bba8-0a57-a565-eeb115120...@case.edu> | > How accurately can you reconstitute? That is, can you maintain the | > difference between $(a b) and $( a b ) for example ? How about $(a b)

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread Martijn Dekker
Op 01-02-22 om 15:23 schreef Chet Ramey: Historically, bash (and ksh93) has favored the former. Just about all the other shells claiming some sort of POSIX conformance favor the latter (all the ash-based shells, yash, mksh). What are your plans here? I've no current plans. Any remotely

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread Chet Ramey
On 2/2/22 8:25 AM, L A Walsh wrote: > I.e. My bash is posix compliant by default w/r/t aliases: It's not, and that's how this whole issue got started. You're running bash-4.4. POSIX requires the following to work: alias switch=case echo $(switch foo in foo) echo ok 2;; esac ) and it simply

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread Chet Ramey
On 2/1/22 5:31 PM, Robert Elz wrote: > Date:Tue, 1 Feb 2022 15:39:06 -0500 > From:Chet Ramey > Message-ID: <2816cf78-d7be-b9e1-733d-12427b04c...@case.edu> > > | When you say "just parsed," when are aliases expanded? > > During lexical analysis, right between when

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread Robert Elz
And I forgot to say, that obviously for this, aliases need to be being expanded, if they're not, there cannot possibly be an issue with aliases, can there? kre

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread L A Walsh
On 2022/02/01 07:50, Chet Ramey wrote: "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)."

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread Martijn Dekker
Op 02-02-22 om 13:25 schreef L A Walsh: I can't say for sure, but it would be interesting if anyone else has this result in a bash with aliases on by default: I.e. My bash is posix compliant by default w/r/t aliases:  env -i /bin/bash --noprofile --norc bash-4.4$ shopt -p expand_aliases Of

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread Robert Elz
Date:Wed, 02 Feb 2022 05:25:30 -0800 From:L A Walsh Message-ID: <61fa864a.7090...@tlinx.org> | On 2022/01/31 20:40, Martijn Dekker wrote: | > On the latest code from the devel branch: | I can't say for sure, but it would be interesting if anyone else | has

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread Alex fxmbsw7 Ratchev
ive had many inconsistency with bash this regarding exoerienced On Wed, Feb 2, 2022, 15:00 L A Walsh wrote: > On 2022/01/31 20:40, Martijn Dekker wrote: > > On the latest code from the devel branch: > > GNU bash, versie 5.2.0(35)-alpha (x86_64-apple-darwin18.7.0) > > > > Reproducer script: > >

Re: Incorrect alias expansion within command substitution

2022-02-02 Thread L A Walsh
On 2022/01/31 20:40, Martijn Dekker wrote: On the latest code from the devel branch: GNU bash, versie 5.2.0(35)-alpha (x86_64-apple-darwin18.7.0) Reproducer script: shopt -s expand_aliases alias let='let --' set -x let '1 == 1' : $(let '1 == 1') Output: + let -- '1 == 1' ++ let -- -- '1 ==

Re: Incorrect alias expansion within command substitution

2022-02-01 Thread Chet Ramey
On 2/1/22 1:47 PM, Robert Elz wrote: Date:Tue, 1 Feb 2022 10:23:53 -0500 From:Chet Ramey Message-ID: <1e33f111-b9ff-2d70-adf8-934906321...@case.edu> | Historically, bash (and ksh93) has favored the former. Just about all the | other shells claiming some

Re: Incorrect alias expansion within command substitution

2022-02-01 Thread Robert Elz
Date:Tue, 1 Feb 2022 15:39:06 -0500 From:Chet Ramey Message-ID: <2816cf78-d7be-b9e1-733d-12427b04c...@case.edu> | When you say "just parsed," when are aliases expanded? During lexical analysis, right between when the input is read (if it is read, and isn't from

Re: Incorrect alias expansion within command substitution

2022-02-01 Thread Robert Elz
Date:Tue, 1 Feb 2022 10:23:53 -0500 From:Chet Ramey Message-ID: <1e33f111-b9ff-2d70-adf8-934906321...@case.edu> | Historically, bash (and ksh93) has favored the former. Just about all the | other shells claiming some sort of POSIX conformance favor the latter

Re: Incorrect alias expansion within command substitution

2022-02-01 Thread Alex fxmbsw7 Ratchev
On Tue, Feb 1, 2022, 19:25 Alex fxmbsw7 Ratchev 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< > its hard to limit this

Re: Incorrect alias expansion within command substitution

2022-02-01 Thread Alex fxmbsw7 Ratchev
On Tue, Feb 1, 2022, 19:16 Alex fxmbsw7 Ratchev wrote: > > > On Tue, Feb 1, 2022, 19:11 Chet Ramey 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 >>

Re: Incorrect alias expansion within command substitution

2022-02-01 Thread Alex fxmbsw7 Ratchev
On Tue, Feb 1, 2022, 19:11 Chet Ramey 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

Re: Incorrect alias expansion within command substitution

2022-02-01 Thread Alex fxmbsw7 Ratchev
you'd expand an alias if seen and then reinterpret the whats gotten also to ( possible ) current cmdline before alias 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

Re: Incorrect alias expansion within command substitution

2022-02-01 Thread Chet Ramey
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

Re: Incorrect alias expansion within command substitution

2022-02-01 Thread Chet Ramey
On 1/31/22 11:40 PM, Martijn Dekker wrote: On the latest code from the devel branch: GNU bash, versie 5.2.0(35)-alpha (x86_64-apple-darwin18.7.0) Reproducer script: shopt -s expand_aliases alias let='let --' set -x let '1 == 1' : $(let '1 == 1') Output: + let -- '1 == 1' ++ let -- -- '1 ==

Incorrect alias expansion within command substitution

2022-01-31 Thread Martijn Dekker
On the latest code from the devel branch: GNU bash, versie 5.2.0(35)-alpha (x86_64-apple-darwin18.7.0) Reproducer script: shopt -s expand_aliases alias let='let --' set -x let '1 == 1' : $(let '1 == 1') Output: + let -- '1 == 1' ++ let -- -- '1 == 1' foo: line 5: let: --: syntax error: