PDA

View Full Version : How can have same as knoppix bash auto-complete function



mikekgr
04-05-2004, 08:58 PM
Dear Sirs,

I am trying to improve the bash auto-complete function on a debian box (not knoppix installation). To describe better
what I am trying to say, let's go with an example:
at console (debian installation) I am writing
apt-cache <tab> <tab>
BUT this did not auto-comlete anything. In comparison with my other box that is knoppix (debian) installation, the auto complete function does a vary great job and can auto complete not only all related available apt-cache comands but further more. example:
apt-cache po <tab> -> policy kdelibs <tab> ... give me all related kdelibs
packages (ex. kdelibs3 , kdelibs4 and so on)
I missed this very goot and intuitive function on my debian box and I am looking for how can have same functionality as knoppix.
Any idea ??? Is there anybody that can instruct me how can get this ???

Best Regards,
Mike Kranidis

Stephen
04-05-2004, 09:29 PM
If you want it system wide then uncomment the section I have at the bottom in my /etc/bash.bashrc.



HappyTux:/home/stephen# cat /etc/bash.bashrc
# System-wide .bashrc file for interactive bash(1) shells.

# If running interactively, then:
if [ "$PS1" ]; then

# set a fancy prompt (overwrite the one in /etc/profile)
PS1='\u@\h:\w\$ '

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# enable bash completion in interactive shells
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi


Or if you just want it for certain users then you would uncomment the section in their /home/user_name/.bashrc.

mikekgr
04-05-2004, 09:39 PM
Dear Stephen,

I checked bash.bashrc between debian box and knoppix-debian box.
The funny think is that even when I uncomment the particular section did not make the trick. Still did not auto-complete when ex. :
apt-cache <tab> (does nothing but beep) <tab> (does nothing but beep) in debian box ...

anything else that I can check ???

Thanks

Stephen
04-05-2004, 09:58 PM
Dear Stephen,

I checked bash.bashrc between debian box and knoppix-debian box.
The funny think is that even when I uncomment the particular section did not make the trick. Still did not auto-complete when ex. :
apt-cache <tab> (does nothing but beep) <tab> (does nothing but beep) in debian box ...

anything else that I can check ???

Thanks

You have logged out and back in so the file is re-read? If so then I think I'm out of ideas as that is all I had to do on my Debian install here for it to work. Now that I am looking at the what you posted again it would be apt-cache policy <tab> if this was not a typo and would probably better starting with a couple of letters as well at the end of the command.



[05:49 PM Mon Apr 05: stephen @ ~]
>$ apt-cache policy <tab>
Display all 19920 possibilities? (y or n)n
[05:49 PM Mon Apr 05: stephen @ ~]
>$ apt-cache policy ap <tab>
apache appunti-informatica-libera
apache2 aprsd
apache2-common aprsdigi
apache2-dev apsfilter
apache2-doc apt
apache2-modules apt-build
apache2-mpm-perchild apt-cacher

[snip ..]


Edit: If you set it in you /home/user_name/.bashrc then you should make sure that this section is uncommented in the /home/user_name/.bash_profile as well.


# include .bashrc if it exists

if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi


You need to logout and back in for this as well.

mikekgr
04-05-2004, 10:05 PM
Dear Stephen,
I did logout login. No in my case apt-cache policy ap <tab> <tab> does not complete anything in my case (snifff !!!)

Thanks for your help anyway

Stephen
04-05-2004, 11:00 PM
Dear Stephen,
I did logout login. No in my case apt-cache policy ap <tab> <tab> does not complete anything in my case (snifff !!!)

Thanks for your help anyway

Does the file /etc/bash_completion exist on your system and what version of bash are you using? My version is 2.05b-14.

mikekgr
04-06-2004, 06:58 AM
Dear Stephen,
I have already the latest bash from unstable and the /etc/bash_completion exist on my system.
I don't know and I can not excuse the differences in behaviour...

I am getting a little mad about this...

Cheers !