"$exclude"

Loïc Grenié loic.grenie at gmail.com
Sat May 18 07:56:53 UTC 2024


On Sat 18 May 2024 at 03:09, Karl Auer wrote:

> On Fri, 2024-05-17 at 13:17 -0700, MR ZenWiz wrote:
> > Today I typed "$exc<tab>" (without the quotes, of course), but it
> > would not resolve and showed me $excel and $exclude as possibilities.
> >
> > $echo $exclude
> > $
> >
> > It's not there, but bash thinks it is.
>
> Interesting! I get the exact same behaviour. It is found by
> autocompletion, but it does not actually exist. As far as output,
> setting and unsetting goes, it behaves exactly as any other undefined
> variable would:
>
>    ~$ echo "(${exclude})"
>    ()
>    ~$ exclude=fred
>    ~$ echo "(${exclude})"
>    (fred)
>    ~$ unset exclude
>    ~$ echo "(${exclude})"
>    ()
>
> bash doesn't see it except when it's an argument, and doesn't see it
> when the argument list is restricted (try "git $exc[TAB]" for example).
>
> I think it is unexpected side-effect (I won't say bug) of how bash
> completion works internally, possibly related to the '-X' flag. But I
> don't really know.
>

    It might be defined but empty. It's referenced by the completion system,
  so it might get defined behind the scenes.

          Loïc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20240518/c0c25b6c/attachment.html>


More information about the ubuntu-users mailing list