On Sat, May 02, 2026 at 14:35:03 -0600, Stan Marsh wrote:
> { This fails to do what we want, but it is not unexpected }
> $ GLOBIGNORE='Foo_0*' echo Foo*
> Foo_01 Foo_02 Foo_03 Foo_04 Foo_05 Foo_11 Foo_12 Foo_13 Foo_14 Foo_15
> { But this one should work, but doesn't }
> $ GLOBIGNORE='Foo_0*' bash5 -c 'echo "$GLOBIGNORE" "--->" Foo*'
> Foo_0* ---> Foo_01 Foo_02 Foo_03 Foo_04 Foo_05 Foo_11 Foo_12 Foo_13 Foo_14
> Foo_15
> $
>
> Now, each result is reasonable, except the last one.
It does seem wrong.
hobbit:~$ mkdir /tmp/x && cd $_
hobbit:/tmp/x$ touch Foo_01 Foo_02 Foo_11 Foo_12
hobbit:/tmp/x$ GLOBIGNORE='Foo_0*' eval 'echo Foo*'
Foo_11 Foo_12
hobbit:/tmp/x$ GLOBIGNORE='Foo_0*' bash -c 'echo Foo*'
Foo_01 Foo_02 Foo_11 Foo_12
hobbit:/tmp/x$ GLOBIGNORE='Foo_0*' bash -c 'GLOBIGNORE=$GLOBIGNORE; echo Foo*'
Foo_11 Foo_12
Apparently something isn't initialized quite right when the variable is
inherited from the environment, but gets set correctly when the variable
is assigned.
hobbit:/tmp/x$ echo "$BASH_VERSION"
5.2.37(1)-release