bug-bash
[Top][All Lists]
Advanced

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

Minor bug declaring arrays of integers: dcl -ai=>broken, dcl -ia=>ok


From: Linda Walsh
Subject: Minor bug declaring arrays of integers: dcl -ai=>broken, dcl -ia=>ok
Date: Sun, 14 Jul 2013 14:03:19 -0700
User-agent: Thunderbird

In order to declare an array of type int (or an integer array)
I first tried:

declare -ai -g foo=(1 2 xx 3)
echo "${foo[@]}"
1 2 xx 3   <---------incorrect

So then tried:


declare -ia -g foo=(1 2 xx 3) echo "${foo[@]}"
1 2 0 3  <---------correct!

It seems 'declare' is sensitive to the order of its options in an
undesirable way -- i.e. for typed arrays, the -i should be
allowed either before or after the -a (or -A for hashes).

That makes me wonder if the "-g" worked.
I.e. -- if "-g" after "-ia" works, and whether I need "-g -ia"
(or "-gia")

(GNU bash, version 4.2.45(1)-release (x86_64-suse-linux-gnu))



reply via email to

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