Re: Documentation about destroying an array element

2019-08-15 Thread Greg Wooledge
On Thu, Aug 15, 2019 at 12:37:01PM +0300, jarno.s...@saunalahti.fi wrote: > https://www.gnu.org/software/bash/manual/html_node/Arrays.html tells > "unset name[subscript] destroys the array element at index subscript." > > But if there is a file named names, nameu ,nameb, namec, namer, namei,

Documentation about destroying an array element

2019-08-15 Thread jarno . suni
https://www.gnu.org/software/bash/manual/html_node/Arrays.html tells "unset name[subscript] destroys the array element at index subscript." But if there is a file named names, nameu ,nameb, namec, namer, namei, namep or namet in currenct directory, that does not work, unless globbing is

Re: Documentation about destroying an array element

2019-08-15 Thread Chet Ramey
On 8/15/19 9:18 AM, Greg Wooledge wrote: > On Thu, Aug 15, 2019 at 12:37:01PM +0300, jarno.s...@saunalahti.fi wrote: >> https://www.gnu.org/software/bash/manual/html_node/Arrays.html tells >> "unset name[subscript] destroys the array element at index subscript." >> >> But if there is a file named

Associative array entries order differs from declaration

2019-08-15 Thread Léa Gris
While dealing with getting keys of arrays, I found out that associative array keys where not registered in the same order as declared: #!/usr/bin/env bash # Declare and populate an associative array a unset a declare -A a=( ["one"]="first" ["two"]="second" ["three"]="third"

Re: Associative array entries order differs from declaration

2019-08-15 Thread Chet Ramey
On 8/15/19 11:26 AM, Léa Gris wrote: > While dealing with getting keys of arrays, I found out that associative > array keys where not registered in the same order as declared: There's no guarantee that will happen. It's a hash table. -- ``The lyf so short, the craft so long to lerne.'' -

Re: Associative array entries order differs from declaration

2019-08-15 Thread Greg Wooledge
On Thu, Aug 15, 2019 at 05:26:03PM +0200, Léa Gris wrote: > Is there a way to control the order of entries in an associative array? No. > What rules applies to the order of entries? None. If you require both an associative array and an ordered list, then you will need two different data