Using unset to destroy array elements doesn't work with 'nullglob' set
From:
Francis Moreau
Subject:
Using unset to destroy array elements doesn't work with 'nullglob' set
Date:
Fri, 5 Jun 2009 08:35:15 -0700 (PDT)
User-agent:
G2/1.0
Hello,
My version of bash is "GNU bash, version 3.2.33(1)-release (x86_64-
redhat-linux-gnu)" running on a fedora 9.
Here's is a small script to show the bug:
#!/bin/bash
#shopt -s nullglob
foo[0]=0
unset foo[0]
echo ${foo[@]}
When shopt line is commented then the element at index 0 is destroyed
and the echo doesn't output anything. However is a uncomment the shopt
line the element at index 0 is not destroyed anymore and the echo
output "0".
Thanks.