Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15715
| From | Léa Gris <lea@nomail.invalid> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Two states of empty arryays |
| Date | 2019-12-12 17:38 +0100 |
| Organization | French Data Network |
| Message-ID | <mailman.738.1576170768.1979.bug-bash@gnu.org> (permalink) |
| References | <qstqe9$d93$1@solo.fdn.fr> |
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
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Two states of empty arryays Léa Gris <lea@nomail.invalid> - 2019-12-12 17:38 +0100
csiph-web