bug-bash
[Top][All Lists]
Advanced

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

Re: nullglob breaks unset of arrays


From: Mario TRENTINI
Subject: Re: nullglob breaks unset of arrays
Date: Thu, 25 Sep 2008 09:03:38 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

Hi Chet

thanks for your answer, I understand then that
unset "my_array[0]"
works and therefore quoting the argument is the proper way for using
unset.

Regards

Mario


On Wed, Sep 24, 2008 at 11:41:56PM -0400, Chet Ramey wrote:
> mario.trentini_bb@m4x.org wrote:
> 
> > Bash Version: 3.2
> > Patch Level: 39
> > Release Status: release
> > 
> > Description:
> >     When nullglob option is enable (shopt -s nullglob), unset of an array
> >     does not work.
> 
> You're right; it does.  `unset' is a builtin, so all of the shell's word
> expansions are performed before it is run, including globbing.  If you
> don't protect the argument by quoting it, the nullglob extension will
> remove it when there are no matching filenames.  Running the script with
> `bash -x' will show what's happening.
> 
> There's no `fix' -- everything is working as it's supposed to.  You've
> just combined things in a way that produces unexpected results.
> 
> Chet
> -- 
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
> 
> Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/




reply via email to

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