[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Awkward behavior of empty arrays
From: |
Andy Chu |
Subject: |
Re: [Help-bash] Awkward behavior of empty arrays |
Date: |
Tue, 5 Sep 2017 10:51:49 -0700 |
>
> I would also like it if bash would provide a way to safely interpolate
> empty arrays with set -u. Syntax idea:
>
> echo "${A[@@]}"
>
> That way there is no extra mode, which is harder to read IMO.
>
>
Given that I already complained that it takes 8 punctuation characters to
interpolate an array and 10 to copy it [1], I should take this suggestion
back.
A simpler and backward compatible syntax would be:
echo "address@hidden" # like "address@hidden" but an empty array OK with set
-u
I was thinking of using that syntax for arrays in OSH. And if you have
arrays, you don't really need word splitting, so you can argue that
address@hidden
(no quotes) should be the same as "address@hidden". It's less consistent, but
then
the common case with fewer characters is correct. Or I might just leave
out address@hidden (syntax error) and only provide "address@hidden".
Andy
[1] http://www.oilshell.org/blog/2016/11/06.html
- Re: [Help-bash] Awkward behavior of empty arrays, Cristian Zoicas, 2017/09/05
- Re: [Help-bash] Awkward behavior of empty arrays, DJ Mills, 2017/09/05
- Re: [Help-bash] Awkward behavior of empty arrays, Andy Chu, 2017/09/05
- Re: [Help-bash] Awkward behavior of empty arrays,
Andy Chu <=
- Re: [Help-bash] Awkward behavior of empty arrays, Cristian Zoicas, 2017/09/07
- Re: [Help-bash] Awkward behavior of empty arrays, Cristian Zoicas, 2017/09/07
- Re: [Help-bash] Awkward behavior of empty arrays, Cristian Zoicas, 2017/09/07
- Re: [Help-bash] Awkward behavior of empty arrays, Greg Wooledge, 2017/09/07