Hi all, thx for your answers. TBH, I couldn't follow all your explanations, but the gist, is, that it's intentional and not a bug. We will use the ${#foo[@]} > 0 test, that is probably the right in our situation. Background is, the test is in shared code, and we are doing some sanity checks on the data passed to the shared code.

BR, Christian


Am 29.08.23 um 20:19 schrieb Chet Ramey:
On 8/29/23 11:56 AM, Kerin Millar wrote:

One hopes that the shell programmer knows what variable types he's
using, and uses the appropriate constructs.

Some elect to source shell code masquerading as configuration data (or are using programs that elect to do so). Otherwise, yes, definitely.

If you find yourself needing to know whether a variable is an associative
array, an indexed array, or a scalar, check the output of the @a variable
transformation.


--
---------------------------------------------------------------------
RADIODATA GmbH
Newtonstr. 18
12489 Berlin
Germany

Homepage:              www.radiodata.biz

USt_IdNr.:             DE 195663499
WEEE-Reg.-Nr.:         DE 63967380

Sitz der Gesellschaft: Berlin
Registergericht:       Amtsgericht Charlottenburg HRB  Nr.: 67865
Geschäftsführer:       Hans-Joachim Langermann, Malte Langermann

Reply via email to