[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: parameter expansion null check fails for arrays when [*] or [@] is u
From: |
Greg Wooledge |
Subject: |
Re: parameter expansion null check fails for arrays when [*] or [@] is used |
Date: |
Wed, 23 Mar 2022 07:38:39 -0400 |
On Wed, Mar 23, 2022 at 01:48:48AM -0700, L A Walsh wrote:
> On 2022/03/23 00:25, Ilkka Virta wrote:
> > The POSIX phraseology is that "null" means the empty string.
> ----
> POSIX phraseology applies to the POSIX language.
>
> In 'C'
>
> char *s = NULL
> is not the same as
> char *s="";
Yes, we know this. But this is bug-bash, so we're discussing the shell
known as bash. Bash doesn't have pointers, so it cannot have NULL pointers
either.
Would I have chosen to use the word "null" to mean "empty string" in
the shell's documentation, if I were writing it? No. I wouldn't have,
because it's an overloaded word with very different meanings in different
contexts (cf. SQL's NULL, and the ASCII NUL character).
But as it happens, the writers of the POSIX standards *did* use that
word in some places, and so we have to live with it.
unicorn:~$ man 1p sh | grep -i null
argument. If FCEDIT is null or unset, ed shall be used as the
ables that are unset or null. (See the Base Definitions vol‐
Back to the original topic, I have absolutely no idea what "${a[@]:+word}"
is supposed to do. It doesn't make any sense to me, and I would never
write that in a script. So, I have no comments about it in terms of
this bug report.
Re: parameter expansion null check fails for arrays when [*] or [@] is used, Chet Ramey, 2022/03/23