Re: Zero-length indexed arrays

2021-12-16 Thread Lawrence Velázquez
On Thu, Dec 16, 2021, at 11:45 PM, Lawrence Velázquez wrote: > Did you mean to say that ${#FOO[*]} causes an error? Because > ${FOO[*]} does not, à la $*: > > [...] > > Like ${FOO[*]}, ${FOO[@]} and $@ are exempt from ''set -u''. Perhaps you're using an old bash, like the one shipped with macOS?

Re: Zero-length indexed arrays

2021-12-16 Thread Lawrence Velázquez
On Thu, Dec 16, 2021, at 11:01 PM, Dale R. Worley wrote: > A bit ago I was debugging a failing script at work. It turns out that > when you say > FOO=(x y z) > then the variable FOO is an array and is defined. But when you say > FOO=() > then the variable FOO is an array (because ${#FOO[*

Zero-length indexed arrays

2021-12-16 Thread Dale R. Worley
A bit ago I was debugging a failing script at work. It turns out that when you say FOO=(x y z) then the variable FOO is an array and is defined. But when you say FOO=() then the variable FOO is an array (because ${#FOO[*]} substitutes an integer viz. 0) but it is *not* defined (because ${

Space vs. non-space separators in COMP_WORDBREAKS

2021-12-16 Thread konsolebox
If I have a function like function _complete_something { printf -v __ '%q ' "$@" logger -p debug -t something "Args: $__" logger -p debug -t something "$(declare -p COMP_WORDS)" } And in COMP_WORDBREAKS I have '=' included in the assignment. And I execute this com

Re: Gnu Bash Manual - Getting the Array Size

2021-12-16 Thread Chet Ramey
On 12/16/21 1:33 PM, fatiparty--- via Bug reports for the GNU Bourne Again SHell wrote: > > Have been reading the Gnu Bash Manual "6.7 Arrays" and there is no mention of > ${#name[*]} to get the array size. "${#NAME[SUBSCRIPT]}' expands to the length of '${NAME[SUBSCRIPT]}'. If SUBSCRIPT is '@

Gnu Bash Manual - Getting the Array Size

2021-12-16 Thread fatiparty--- via Bug reports for the GNU Bourne Again SHell
Have been reading the Gnu Bash Manual "6.7 Arrays" and there is no mention of ${#name[*]} to get the array size.