[Top][All Lists]

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

Empty strings disappear from array splice

From: marc . coiffier
Subject: Empty strings disappear from array splice
Date: Mon, 19 Jan 2015 15:22:36 -0800 (PST)
User-agent: G2/1.0

Hello all,

(This bug was found on a fresh Debian wheezy install)

Here is the minimal code sample to reproduce the bug (present in version 4.2, 
corrected in 4.3 as far as I can tell) :

  arr1=( "" "" )
  arr2=( "address@hidden:1}" )
  if [ address@hidden -eq 1 ]; then
    echo OK
    echo Not OK

On the buggy Bash version, the second affectation creates an empty array 
whereas we expect it to create an array of one empty string.

Oddly enough, the bug is absent from some older Bash versions (3.0 correctly 
reported an array of one element, for instance). 

Thank you for your time,

reply via email to

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