From:   Chet Ramey
Subject: Re: GLOBIGNORE
Date:   Mon, 4 May 2026 15:27:22 -0400

>On 5/2/26 5:46 PM, Stan Marsh wrote:

>>BTW, maybe it is one of those things where the variable is "magic" and
>>the implementation is such that the magic happens as a side effect of
>>the variable being set.  In the case where it is not explicitly set
>>by the current shell process (because it was inherited from the
>>environment), the magic doesn't happen.

>Kind of. GLOBIGNORE changes behavior, so the internal data structures
>that control that are modified when the variable is set or unset.

>GLOBIGNORE has been around 30+ years (I implemented it in 1995 and it
>first appeared in bash-2.0), and I can't recall my thought process
>from back then. It may be that I didn't want one process to be able
>to affect another like that (since GLOBIGNORE is ignored when the shell
>is in privileged mode) but I can't remember. What I can say is that it's
>never been inherited from the environment in that way.

>Chet

OK.  Just a few more comments about this:

    1) It sounds like it is working as designed, but I think the doc
    should be updated to be more explicit about this.  Note,
    incidentally, that you can also demonstrate this from tcsh, like
    this:

    % setenv GLOBIGNORE 'Foo_0*'
    % bash
    $ : Observe that GLOBIGNORE is not active, unless/until you do:
    $ : GLOBIGNORE="$GLOBIGNORE"

    2) This all came about in the course of something I was working on
    where I needed the functionality of GLOBIGNORE, which I had never
    used before.  In doing the usual preliminary testing of it, I
    could not get it to work and thought maybe it just never actually
    got implemented.  Eventually, I figured out that it could not work
    in the expected way (i.e., GLOBIGNORE=... echo Foo*), so ended up
    trying the "run a new copy of bash" thing to see if that works and
    when that didn't work, concluded that it just really doesn't work.
    As mentioned in my previous post, the "eval trick" is a good way
    to get to where one wants to be.

=================================================================================
Please do not send me replies to my posts on the list.
I always read the replies via the web archive, so CC'ing to me is unnecessary.


Reply via email to