Re: No word splitting for assignment-like expressions in compound assignment

2020-07-28 Thread Chet Ramey
On 7/28/20 4:14 PM, Ilkka Virta wrote: > On 28.7. 17:22, Chet Ramey wrote: >> On 7/23/20 8:11 PM, Alexey Izbyshev wrote: >>> $ Z='a b' >>> $ A=(X=$Z) >>> $ declare -p A >>> declare -a A=([0]="X=a b") > >> It's an assignment statement in a context where assignment statements are >> accepted (which

Re: No word splitting for assignment-like expressions in compound assignment

2020-07-28 Thread Ilkka Virta
On 28.7. 17:22, Chet Ramey wrote: On 7/23/20 8:11 PM, Alexey Izbyshev wrote: $ Z='a b' $ A=(X=$Z) $ declare -p A declare -a A=([0]="X=a b") It's an assignment statement in a context where assignment statements are accepted (which is what makes it different from `echo X=$Z', for instance), but

Re: No word splitting for assignment-like expressions in compound assignment

2020-07-28 Thread Chet Ramey
On 7/23/20 8:11 PM, Alexey Izbyshev wrote: > Hello! > > I have a question about the following behavior: > > $ Z='a b' > $ A=(X=$Z) > $ declare -p A > declare -a A=([0]="X=a b") > $ A=(X$Z) > $ declare -p A > declare -a A=([0]="Xa" [1]="b") > > I find it surprising that no word splitting is perfo

Re: No word splitting for assignment-like expressions in compound assignment

2020-07-27 Thread Lawrence Velázquez
> On Jul 27, 2020, at 4:02 AM, Andreas Schwab wrote: > > On Jul 27 2020, Lawrence Velázquez wrote: > >> If word splitting were not performed in compound assignments, this... >> >>foo=(a b c) >> >> ...would not work. > > This is not true. Field splitting is only relevant for words generat

Re: No word splitting for assignment-like expressions in compound assignment

2020-07-27 Thread Greg Wooledge
On Mon, Jul 27, 2020 at 01:31:32AM -0400, Dale R. Worley wrote: > So it seems like the word splitting in "A=(X$Z)" is incorrect. If the documentation doesn't support word splitting in that case, then it's the documentation that will need to change, not the shell. Word splitting in that context is

Re: No word splitting for assignment-like expressions in compound assignment

2020-07-27 Thread Oğuz
27 Temmuz 2020 Pazartesi tarihinde Alexey Izbyshev yazdı: > On 2020-07-27 10:06, Lawrence Velázquez wrote: > >> On Jul 27, 2020, at 1:31 AM, Dale R. Worley wrote: >>> Interesting. The documentation for 4.2.53(1) says this about parameter >>> assignments generally, with no special rules for comp

Re: No word splitting for assignment-like expressions in compound assignment

2020-07-27 Thread Andreas Schwab
On Jul 27 2020, Lawrence Velázquez wrote: > If word splitting were not performed in compound assignments, this... > > foo=(a b c) > > ...would not work. This is not true. Field splitting is only relevant for words generated by other expansions, not for literal tokens. Andreas. -- Andreas

Re: No word splitting for assignment-like expressions in compound assignment

2020-07-27 Thread Alexey Izbyshev
On 2020-07-27 10:06, Lawrence Velázquez wrote: On Jul 27, 2020, at 1:31 AM, Dale R. Worley wrote: Interesting. The documentation for 4.2.53(1) says this about parameter assignments generally, with no special rules for compound assignments: All values undergo tilde expansion, para

Re: No word splitting for assignment-like expressions in compound assignment

2020-07-27 Thread Lawrence Velázquez
> On Jul 27, 2020, at 1:31 AM, Dale R. Worley wrote: > > Alexey Izbyshev writes: >> I have a question about the following behavior: >> >> $ Z='a b' >> $ A=(X=$Z) >> $ declare -p A >> declare -a A=([0]="X=a b") >> $ A=(X$Z) >> $ declare -p A >> declare -a A=([0]="Xa" [1]="b") >> >> I find it su

Re: No word splitting for assignment-like expressions in compound assignment

2020-07-26 Thread Dale R. Worley
Alexey Izbyshev writes: > I have a question about the following behavior: > > $ Z='a b' > $ A=(X=$Z) > $ declare -p A > declare -a A=([0]="X=a b") > $ A=(X$Z) > $ declare -p A > declare -a A=([0]="Xa" [1]="b") > > I find it surprising that no word splitting is performed in the first > compound as

No word splitting for assignment-like expressions in compound assignment

2020-07-23 Thread Alexey Izbyshev
Hello! I have a question about the following behavior: $ Z='a b' $ A=(X=$Z) $ declare -p A declare -a A=([0]="X=a b") $ A=(X$Z) $ declare -p A declare -a A=([0]="Xa" [1]="b") I find it surprising that no word splitting is performed in the first compound assignment. I realize that skipping word