Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: =?UTF-8?B?TMOpYSBHcmlz?= Newsgroups: gnu.bash.bug Subject: Two states of empty arryays Date: Thu, 12 Dec 2019 17:38:32 +0100 Organization: French Data Network Lines: 30 Approved: bug-bash@gnu.org Message-ID: References: NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: usenet.stanford.edu 1576170768 28057 209.51.188.17 (12 Dec 2019 17:12:48 GMT) X-Complaints-To: action@cs.stanford.edu To: gnu-bash-bug@moderators.isc.org Envelope-to: bug-bash@gnu.org User-Agent: Telnet/1.0 [tlh] (PDP11/DEC) Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 130.133.4.7 X-Mailman-Approved-At: Thu, 12 Dec 2019 12:12:47 -0500 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: Xref: csiph.com gnu.bash.bug:15715 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