Bash programmable completion of variable names

PleegWat pleegwat at telfort.nl
Mon Jun 22 20:12:41 UTC 2009


Hal Burgiss wrote:
> On Mon, Jun 22, 2009 at 07:25:52PM +0200, PleegWat wrote:
> 
>> I'm not quite able to reproduce either behaviour. Does a file/directory 
>> whose name starts with '$c' exist in the current working directory, or 
>> is CDPATH set and does a directory with such name exist in a directory 
>> in CDPATH?
> 
> Nice try, but no go.
> 
> Well, bash completion (if enabled) is capable of expanding all kinds of
> things, including declared variables, hostnames, etc. Quite handy. Ubuntu may
> have this off, I can't remember. If so, its commented out in the stock
> /etc/bash.bashrc IIRC. 

I know about it, ubuntu has quite a lot of them configured by default. 
It's one thing that's been annoying me at work, cause all of the servers 
are rhel 5 and I can't install completions there.

It's acting weird here. If I set $c, and type 'echo $c<tab>' or 'cd 
$c<tab>', it completes with a space. If I type 'cd $c/<tab>', it expands 
to 'cd \$c' and beeps for not being able to find anything.

Is there a switch somewhere for tab to expand variables?

PleegWat





More information about the ubuntu-users mailing list