Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16641

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

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: No word splitting for assignment-like expressions in compound assignment
Date 2020-07-28 17:34 -0400
Organization ITS, Case Western Reserve University
Message-ID <mailman.219.1595972099.2739.bug-bash@gnu.org> (permalink)
References <6614fa7668daf7f2b450e319a28b624c@ispras.ru> <58020735-2ddb-e1a4-a513-a09560876e87@case.edu> <071ced16-0537-133d-8c1b-f54fefac1e33@iki.fi> <c5c7d72a-d550-4dea-0b59-f75bc520a7f8@case.edu>

Show all headers | View raw


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 is what makes it different from `echo X=$Z', for instance),
>> but the lack of a subscript on the lhs makes it a special case. I'll take a
>> look at the semantics here.
> 
> This is also a bit curious:
> 
>  $ b=( [123]={a,b,c}x )
>  $ declare -p b
>  declare -a b=([0]="[123]=ax" [1]="[123]=bx" [2]="[123]=cx")
> 
> It does seem to have a subscript on the LHS, but it didn't work as one.
> To be in line with a plain scalar assignment, the braces should probably
> not be expanded here.

Thanks, I'll look at it.


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

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: No word splitting for assignment-like expressions in compound assignment Chet Ramey <chet.ramey@case.edu> - 2020-07-28 17:34 -0400

csiph-web