Discussion:
tab completion being overenthusiastic
(too old to reply)
Eben King
2024-09-07 13:00:02 UTC
Permalink
Hi. I have bash 5.2.15(1). When I cd into an empty directory, and type "cd
<tab><tab>", the shell offers 178 possibilities. If I restrict it to an
initial letter and hit <tab> once, I think the spurious offerings are from
$HOME. How can I make it not do that and only offer me things I ask for?

--
Unfortunately, our Bright Young PFY will no longer be assisting
with expeditions downtown, as he has been dubbed the
Telecom Destruction Bunny and banned from taking
his aura anywhere near anything major. -- Anthony DeBoer on ASR
Greg Wooledge
2024-09-07 13:30:02 UTC
Permalink
Post by Eben King
Hi. I have bash 5.2.15(1). When I cd into an empty directory, and type "cd
<tab><tab>", the shell offers 178 possibilities. If I restrict it to an
initial letter and hit <tab> once, I think the spurious offerings are from
$HOME. How can I make it not do that and only offer me things I ask for?
Do you perhaps have the CDPATH variable set? That might affect tab
completion for the cd command.
e***@gmx.us
2024-09-07 13:40:01 UTC
Permalink
Post by Greg Wooledge
Post by Eben King
Hi. I have bash 5.2.15(1). When I cd into an empty directory, and type "cd
<tab><tab>", the shell offers 178 possibilities. If I restrict it to an
initial letter and hit <tab> once, I think the spurious offerings are from
$HOME. How can I make it not do that and only offer me things I ask for?
Do you perhaps have the CDPATH variable set? That might affect tab
completion for the cd command.
***@cerberus:~$ echo "$CDPATH"
:~:/

0
***@cerberus:~$ grep CDPATH /etc/profile /etc/profile.d/* ~/.profile
~/.bash_profile
1
***@cerberus:~$

In fact I do. Good catch. Any idea where it could be set, other than the
places I looked?

--
GEMINI: Your birthday party will be ruined once again by your explosive
flatulence. Your love life will run into trouble when your fiancee hurls
a javelin through your chest. -- Weird Al, _Your Horoscope for Today_
e***@gmx.us
2024-09-07 14:00:01 UTC
Permalink
Post by e***@gmx.us
Post by Greg Wooledge
Post by Eben King
Hi. I have bash 5.2.15(1). When I cd into an empty directory, and
type "cd <tab><tab>", the shell offers 178 possibilities. If I
restrict it to an initial letter and hit <tab> once, I think the
spurious offerings are from $HOME. How can I make it not do that and
only offer me things I ask for?
Do you perhaps have the CDPATH variable set? That might affect tab
completion for the cd command.
0
In fact I do. Good catch. Any idea where it could be set, other than
the places I looked?
Got it. It was in ~/.bash-vars which was sourced from ~/.bash_profile . Is
that a standard thing, or just some "brilliant" idea I had once upon a time?

--
Only two things are infinite, the universe and human stupidity,
and I'm not sure about the former." -- Albert Einstein
Greg Wooledge
2024-09-07 14:10:01 UTC
Permalink
Post by e***@gmx.us
Got it. It was in ~/.bash-vars which was sourced from ~/.bash_profile . Is
that a standard thing, or just some "brilliant" idea I had once upon a time?
It's not a standard file.

By the way, there's a trick you can use to find out where shell variables
are being defined:

PS4='+ $BASH_SOURCE:$FUNCNAME:$LINENO:' bash -ilxc : 2>&1 | grep CDPATH

The -il options run an interactive login shell. If you need to check an
interactive non-login shell instead, just change the options to -ixc.

This won't work as root, because PS4 from the environment is suppressed
for security reasons when running bash as root.
e***@gmx.us
2024-09-07 15:10:01 UTC
Permalink
Post by Greg Wooledge
By the way, there's a trick you can use to find out where shell variables
PS4='+ $BASH_SOURCE:$FUNCNAME:$LINENO:' bash -ilxc : 2>&1 | grep CDPATH
The -il options run an interactive login shell. If you need to check an
interactive non-login shell instead, just change the options to -ixc.
This won't work as root, because PS4 from the environment is suppressed
for security reasons when running bash as root.
Excellent, thank you.

--
Q: What did one photon say to the other photon?
A: I'm sick and tired of your interference. -- thebigmike1983 on Fark
t***@tuxteam.de
2024-09-07 19:20:02 UTC
Permalink
On Sat, Sep 07, 2024 at 10:07:00AM -0400, Greg Wooledge wrote:

[...]
Post by Greg Wooledge
By the way, there's a trick you can use to find out where shell variables
PS4='+ $BASH_SOURCE:$FUNCNAME:$LINENO:' bash -ilxc : 2>&1 | grep CDPATH
Nifty! Thanks for this one.

Cheers
--
t
David Wright
2024-09-09 13:50:01 UTC
Permalink
Post by e***@gmx.us
Got it. It was in ~/.bash-vars which was sourced from ~/.bash_profile . Is
that a standard thing, or just some "brilliant" idea I had once upon a time?
If you mean the file itself, you might try stat ~/.bash-vars
and looking at the Birth date; then you could check out your
Sent Mail folder and see whether you were discussing anything
relevant around that time. Other places that might help are
your browser's history, and the index for debian-user.

Cheers,
David.

Loading...