On 12/12/19 12:08 PM, Léa Gris wrote:
Hello,

Depending on how an empty array is declared, it is not stored with the
same state.

# Empty array declared without parenthesis
unset myArr
declare -a myArr
typeset -p myArr
echo "${#myArr[@]}"

This is an unset variable with the array attribute; you have not assigned a
value.


# Empty array declared without parenthesis
unset myArr
declare -a myArr=()

This is an empty array variable; you have assigned a value.


--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/

Reply via email to