[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Two states of empty arryays
From: |
Léa Gris |
Subject: |
Two states of empty arryays |
Date: |
Thu, 12 Dec 2019 17:38:32 +0100 |
User-agent: |
Telnet/1.0 [tlh] (PDP11/DEC) |
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[@]}"
output:
declare -a myArr
0
# Empty array declared without parenthesis
unset myArr
declare -a myArr=()
typeset -p myArr
echo "${#myArr[@]}"
output:
declare -a myArr=()
0
What is the reason for having different states for empty arrays?
--
Lea Gris
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Two states of empty arryays,
Léa Gris <=