View previous topic :: View next topic |
Author |
Message |
wilburpan l33t
Joined: 21 Jan 2003 Posts: 977
|
Posted: Sat Sep 27, 2003 1:24 am Post subject: Unexpected bash completion behavior |
|
|
I recently noticed strange behavior with bash completion. If I use the tab key multiple times on the same command line to complete, on the second or higher time I hit tab the completion does not leave a trailing "/" at the end of the line. I seem to remember that hitting tab would continue to leave trailing slashes if the completion was a directory.
For instance, if I am using tabs to quickly get to /usr/portage/kde-base/kdebase/kdebase-3.2.0_alpha2.ebuild, this is what happens:
Code: | I type:
/usr/port [tab]
The completion works as expected:
"/usr/portage/"
I then type:
kde-b [tab]
The completion looks like this:
"/usr/portage/kdebase " {note trailing space, no trailing slash}
I expect the completion to look like this:
"/usr/portage/kdebase/"
|
If I keep trying to use [tab] to complete, I keep getting trailing spaces instead of trailing slashes.
This may or may not be related, but I first noticed this after trying to emerge KDE 3.2 alpha packages, but this behavior persists even if I am working in a regular console (no desktop/window manager). _________________ I'm only hanging out in OTW until I get rid of this stupid l33t ranking.....Crap. That didn't work. |
|
Back to top |
|
|
ecatmur Advocate
Joined: 20 Oct 2003 Posts: 3595 Location: Edinburgh
|
Posted: Wed Dec 31, 2003 8:40 pm Post subject: |
|
|
Good spot.
I guess it's a bug in /etc/bash_completion.d/gentoo.
Try this patch: Code: | --- gentoo.completion-20031225 2003-12-27 11:40:37.000000000 +0000
+++ /etc/bash_completion.d/gentoo 2003-12-31 20:32:26.000000000 +0000
@@ -286,7 +286,9 @@
fi
if [ "${cur}" ]; then
- if [ $(echo "${cur}" | grep '/') ]; then
+ if [[ "${cur} " == @('/'|'.'|'~'|'$')* ]]; then
+ COMPREPLY=''
+ elif [ $(echo "${cur}" | grep '/') ]; then
setbig=$(compgen -G "${cur}*" | ${sedcmd})"${systemactions}"
COMPREPLY=($(echo "${setbig}" | $grepcmd))
else
|
|
|
Back to top |
|
|
ecatmur Advocate
Joined: 20 Oct 2003 Posts: 3595 Location: Edinburgh
|
|
Back to top |
|
|
viperlin Veteran
Joined: 15 Apr 2003 Posts: 1319 Location: UK
|
Posted: Wed Dec 31, 2003 9:11 pm Post subject: Re: Unexpected bash completion behavior |
|
|
wilburpan wrote: |
Must...resist...posting....
One...step...closer...to...getting...stupid...l33t...ranking....
|
very offtopic but about your .sig
i know exactly what you mean, but i'm close to Veteran now |
|
Back to top |
|
|
wilburpan l33t
Joined: 21 Jan 2003 Posts: 977
|
Posted: Tue Jan 13, 2004 1:42 am Post subject: |
|
|
Thanks for the patch -- I'll try it tomorrow. Somehow I missed this thread when it came out.
Regarding my .sig: So I guess that the good news is that a stupid l33t ranking, like most things, shall pass eventually.
The bad news is that I guess I'll have to start hanging out in Off The Wall. _________________ I'm only hanging out in OTW until I get rid of this stupid l33t ranking.....Crap. That didn't work. |
|
Back to top |
|
|
|