Re: Using unset to destroy array elements doesn't work with 'nullglob' set

2009-06-06 Thread Francis Moreau
On 5 juin, 20:29, Chet Ramey wrote: > Francis Moreau wrote: > > 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 >

Re: Using unset to destroy array elements doesn't work with 'nullglob' set

2009-06-05 Thread Chet Ramey
Francis Moreau wrote: > 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 ${f...@]} > > When shopt l

Re: Using unset to destroy array elements doesn't work with 'nullglob' set

2009-06-05 Thread Francis Moreau
On Fri, Jun 5, 2009 at 6:05 PM, Greg Wooledge wrote: > On Fri, Jun 05, 2009 at 08:35:15AM -0700, Francis Moreau wrote: >> unset foo[0] > > This is a problem in your script, unfortunately.  Even without nullglob, > this can still fail if you happen to have a file named foo0 in your > current workin

Re: Using unset to destroy array elements doesn't work with 'nullglob' set

2009-06-05 Thread Greg Wooledge
On Fri, Jun 05, 2009 at 08:35:15AM -0700, Francis Moreau wrote: > unset foo[0] This is a problem in your script, unfortunately. Even without nullglob, this can still fail if you happen to have a file named foo0 in your current working directory, which would be matched as a glob. For total safety

Using unset to destroy array elements doesn't work with 'nullglob' set

2009-06-05 Thread Francis Moreau
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 ${f...@]} When shopt line is commented then the element at index 0 is destro