[Bash-completion-devel] [bash-completion-Bugs][313199] Completion for the `cd` command does not expand variables.

bash-completion-bugs at alioth.debian.org bash-completion-bugs at alioth.debian.org
Tue Nov 15 23:35:56 UTC 2011


Bugs item #313199, was changed at 2011-07-01 02:52 by Igor Murzov
You can respond by visiting: 
https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=313199&group_id=100114

>Status: Pending
Priority: 3
Submitted By: Nobody (None)
Assigned to: Nobody (None)
Summary: Completion for the `cd` command does not expand variables. 
Distribution: --Distribution-Agnostic--
Originally reported in: None
Milestone: None
>Status: Fix Committed
Original bug number: 


Initial Comment:
Anonymous message posted by deadhead.russell at gmail.com

Currently, bash_completion will auto complete variables for the `cd` command.  However, these variables are not expanded making auto-completion not work for the remainder of the command.

Example:
Lets say I have a variable, `$variable` which is `/path/to` and I have the folder structure, `/path/to/directory/`.

cd $variable/direct<TAB>

currently does nothing.  I expect it to expand the variable and complete it to:

cd /path/to/directory/

I have created a patch where variables are still auto completed.  However, if only one match is returned, the matched variable is expanded and the completion continues.

----------------------------------------------------------------------

>Comment By: Igor Murzov (garik-guest)
Date: 2011-11-16 03:35

Message:
Should be fixed in commits:
http://anonscm.debian.org/gitweb/?p=bash-completion/bash-completion.git;a=commit;h=ff8e52c9605fa0a40d642d1ddb57ada11213ac3c
http://anonscm.debian.org/gitweb/?p=bash-completion/bash-completion.git;a=commit;h=88b897e2241a728ca9d37fdcfa005930f8c59870


----------------------------------------------------------------------

Comment By: Andrew Russell (deadhead-guest)
Date: 2011-07-02 03:44

Message:
I have modified the patch slightly such that auto-completing of variables that returns no matches does not auto-complete to the empty string.

This changes the following line:

+        if [[ "${#variables[1]}" -ne 0 ]]; then

To this new line:

+        if [[ "${#variables[1]}" -ne 0 ]] || [[ "${#variables[@]}" -eq 0 ]]; then

----------------------------------------------------------------------

You can respond by visiting: 
https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=313199&group_id=100114



More information about the Bash-completion-devel mailing list