"$exclude"

Karl Auer kauer at biplane.com.au
Sat May 18 01:07:03 UTC 2024


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.

Regards, K.


-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer at biplane.com.au, he/him)
http://www.biplane.com.au/kauer






More information about the ubuntu-users mailing list