help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] Awkward behavior of empty arrays


From: Greg Wooledge
Subject: Re: [Help-bash] Awkward behavior of empty arrays
Date: Thu, 31 Aug 2017 08:14:00 -0400
User-agent: NeoMutt/20170113 (1.7.2)

On Thu, Aug 31, 2017 at 02:51:58AM -0700, Andy Chu wrote:
> also invalid:
> "${A}"  # this is an implicit "address@hidden" but is confusing

Actually, it's even worse than that.  "${A}" and "$A" and "${A[0]}"
are all equivalent.

wooledg:~$ A=(an array); echo "${A}"
an
wooledg:~$ unset A; A[1]=an; echo "${A}"

wooledg:~$ unset A; declare -A A; A[zebra]=an A[1]=ugly A[0]=array; echo "${A}"
array

The equivalence of $A == ${A[0]} is one of the most horribly annoying
misfeatures ever.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]