bug-bash
[Top][All Lists]
Advanced

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

Unsetting all elements of an associative array


From: isabella parakiss
Subject: Unsetting all elements of an associative array
Date: Wed, 4 Feb 2015 09:12:12 +0100

I'm trying to use unset array[@] to empty an associative array, but something
goes wrong.

This behaves as expected:
$ declare -A array; array[path/directory]=value

This produces an error:
$ declare -A array; unset array[@]; array[path/directory]=value
bash: path/directory: division by 0 (error token is "directory")

After unsetting all its elements, the array is not associative anymore?

Using array=() empties the array correctly.



reply via email to

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