[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: nullglob breaks unset of arrays
From: |
Chet Ramey |
Subject: |
Re: nullglob breaks unset of arrays |
Date: |
Wed, 24 Sep 2008 23:41:56 -0400 |
User-agent: |
Thunderbird 2.0.0.16 (Macintosh/20080707) |
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/