15 Ocak 2021 Cuma tarihinde Chet Ramey yazdı:
>
> a fix for which is in the devel branch.
Thanks!
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
> ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/
On 1/15/21 11:50 AM, felix wrote:
$ bash <(declare -f f |
sed '1,2d;$s/.*/echo $BASH_VERSION/;s/local /declare /;')
12
/dev/fd/63: line 4: a[1]4: syntax error in expression (error token is "4")
12
declare -ai a=([0]="0" [1]="12")
5.1.4(1)-release
It's all the same
This seem linked:
$ f() {
local -a a=('' 'foo');
local -n b=a[1];
echo $b;
b+=\ bar;
echo $b;
declare -p a;
}
$ f
foo
foo bar
declare -a a=([0]="" [1]="foo bar")
Ok, fine!
$ bash <(declare -f f | sed '1,2d; $s/.*/echo $BASH_VERSION
On 1/14/21 10:31 AM, Léa Gris wrote:
Le 14/01/2021 à 16:15, Chet Ramey écrivait :
On 1/13/21 4:40 PM, Léa Gris wrote:
Le 13/01/2021 à 22:13, Chet Ramey écrivait :
The `-i' forces arithmetic evaluation, which makes this expand to the
equivalent of `declare -n b=1'. That's an invalid name for a
Le 14/01/2021 à 16:15, Chet Ramey écrivait :
On 1/13/21 4:40 PM, Léa Gris wrote:
Le 13/01/2021 à 22:13, Chet Ramey écrivait :
The `-i' forces arithmetic evaluation, which makes this expand to the
equivalent of `declare -n b=1'. That's an invalid name for a nameref,
which you'd see if you used
On 1/13/21 4:40 PM, Léa Gris wrote:
Le 13/01/2021 à 22:13, Chet Ramey écrivait :
The `-i' forces arithmetic evaluation, which makes this expand to the
equivalent of `declare -n b=1'. That's an invalid name for a nameref,
which you'd see if you used `declare -n b=1' instead. The assignment
error
14 Ocak 2021 Perşembe tarihinde Léa Gris yazdı:
> Le 13/01/2021 à 22:13, Chet Ramey écrivait :
>
>> The `-i' forces arithmetic evaluation, which makes this expand to the
>> equivalent of `declare -n b=1'. That's an invalid name for a nameref,
>> which you'd see if you used `declare -n b=1' instea
Le 13/01/2021 à 22:13, Chet Ramey écrivait :
The `-i' forces arithmetic evaluation, which makes this expand to the
equivalent of `declare -n b=1'. That's an invalid name for a nameref,
which you'd see if you used `declare -n b=1' instead. The assignment
error causes `declare' to return an non-ze
On 1/13/21 1:11 PM, Léa Gris wrote:
echo $BASH_VERSION
5.0.17(1)-release
unset a b
declare -ai a=(1)
declare -in b="a[0]"
The `-i' forces arithmetic evaluation, which makes this expand to the
equivalent of `declare -n b=1'. That's an invalid name for a nameref,
which you'd see if you used
On 1/13/21 12:00 PM, Oğuz wrote:
See:
$ declare -ai a=1
$ declare -n b=a[0]
$ b+=1
bash: a[0]1: syntax error in expression (error token is "1")
Reproducible on 5.1.4 too
Interesting. The root cause of this problem has existed since June, 2012,
when I first added namerefs.
On Wed, Jan 13, 2021 at 08:50:45PM +0200, Ilkka Virta wrote:
>However, nameref variables can reference array variables and subscripted
> array variables.
Ah, that's in a different section of the man page. OK, I concede that
this is a bug, then.
>
> Lots of things "could be useful" if only they worked, but they don't work,
> so you don't do them.
>
Yes, and it does work in 4.4.
> The fact that this undocumented, unsupported hack "appeared to work"
> with certain inputs in bash 4.4 is just an unfortunate event, unless
> Chet decides to m
On Wed, Jan 13, 2021 at 8:49 PM Greg Wooledge wrote:
> On Wed, Jan 13, 2021 at 07:00:42PM +0200, Oğuz wrote:
> > $ declare -n b=a[0]
>
> I can't see any documentation that supports the idea that this should
> be allowed in the first place.
>
It's common sense. `declare a[0]=x' works, `unset
On Wed, Jan 13, 2021 at 08:28:44PM +0200, Ilkka Virta wrote:
> On Wed, Jan 13, 2021 at 7:49 PM Greg Wooledge wrote:
> > On Wed, Jan 13, 2021 at 07:00:42PM +0200, Oğuz wrote:
> > > $ declare -n b=a[0]
> >
> > I can't see any documentation that supports the idea that this should
> > be allowed i
On Wed, Jan 13, 2021 at 7:49 PM Greg Wooledge wrote:
> On Wed, Jan 13, 2021 at 07:00:42PM +0200, Oğuz wrote:
> > $ declare -n b=a[0]
>
> I can't see any documentation that supports the idea that this should
> be allowed in the first place.
>
It's arguably useful though, and works in 4.4 (wit
Le 13/01/2021 à 18:49, Greg Wooledge écrivait :
On Wed, Jan 13, 2021 at 07:00:42PM +0200, Oğuz wrote:
$ declare -n b=a[0]
I can't see any documentation that supports the idea that this should
be allowed in the first place.
-n Give each name the nameref attribute, ma
On Wed, Jan 13, 2021 at 07:00:42PM +0200, Oğuz wrote:
> $ declare -n b=a[0]
I can't see any documentation that supports the idea that this should
be allowed in the first place.
-n Give each name the nameref attribute, making it a name
reference to ano
See:
$ declare -ai a=1
$ declare -n b=a[0]
$ b+=1
bash: a[0]1: syntax error in expression (error token is "1")
Reproducible on 5.1.4 too
--
Oğuz
18 matches
Mail list logo