[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))
- Minor bug declaring arrays of integers: dcl -ai=>broken, dcl -ia=>ok,
Linda Walsh <=
- Re: Minor bug declaring arrays of integers: dcl -ai=>broken, dcl -ia=>ok, Chet Ramey, 2013/07/21
- Re: Minor bug declaring arrays of integers: dcl -ai=>broken, dcl -ia=>ok, Dan Douglas, 2013/07/21
- Re: Minor bug declaring arrays of integers: dcl -ai=>broken, dcl -ia=>ok, Linda Walsh, 2013/07/21
- Re: Minor bug declaring arrays of integers: dcl -ai=>broken, dcl -ia=>ok, Dan Douglas, 2013/07/21
- Re: Minor bug declaring arrays of integers: dcl -ai=>broken, dcl -ia=>ok, Linda Walsh, 2013/07/22
- Re: Minor bug declaring arrays of integers: dcl -ai=>broken, dcl -ia=>ok, Dan Douglas, 2013/07/22
- Re: Minor bug declaring arrays of integers: dcl -ai=>broken, dcl -ia=>ok, Chet Ramey, 2013/07/22
- Re: Minor bug declaring arrays of integers: dcl -ai=>broken, dcl -ia=>ok, Linda Walsh, 2013/07/23
- Re: Minor bug declaring arrays of integers: dcl -ai=>broken, dcl -ia=>ok, Chet Ramey, 2013/07/27
- Re: Minor bug declaring arrays of integers: dcl -ai=>broken, dcl -ia=>ok, Linda Walsh, 2013/07/28