Art Alexion on 16 Jun 2005 14:40:09 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] ubuntu hoary upgrade issues: bash completion (solved!)


Art Alexion wrote:

>Stephen Gran wrote:
>
>  
>
>>On Wed, Jun 15, 2005 at 10:07:06AM -0400, Art Alexion said:
>> 
>>
>>    
>>
>>>I upgraded from warty to hoary a couple of weeks ago, and have a couple
>>>of issues I can't seem to resolve on my own.
>>>
>>>  1. _Bash Completion_ -- With warty, bash completion worked on
>>>     executable parameters.  For example, if I did a "sudo apt-get
>>>     update", completion worked not just for "sudo" but also "apt-get"
>>>     and "update".  Now, only document parameters are supported by bash
>>>     completion.  For example, with "gedit ~/Documents/document",
>>>     "document" will complete as well as gedit.  I don't think this is
>>>     a bash 3 problem, but rather a configuration problem.  Any ideas
>>>     how to fix?
>>>   
>>>
>>>      
>>>
>Looking at ~/.bashrc reminded me to look at /etc/bash_completion.  Could
>this section of the latter file be the problem?
>
># start of section containing compspecs that can be handled within bash
>
># user commands see only users
>complete -u su usermod userdel passwd chage write chfn groups slay w
>
># group commands see only groups
>[ -n "$bash205" ] && complete -g groupmod groupdel newgrp 2>/dev/null
>
>"sudo a" won't complete to apt but rather to document beginning with "a"
>in the user home directory.
>
>  
>
>>A second thought - does apt-get upd<tab> tab complete without the sudo?
>>If so, it is probably a bug in the implementation (completion is trying
>>to complete arguments to sudo rather than apt-get or something).  It
>>does work well here (Debian unstable).
>> 
>>
>>    
>>
>No.  "apt-g" will not complete to "apt-get", "apt-get u" completes to
>"apt-get unshorten"!
>  
>
For other Ubuntu users with this bash completion problem, I have solved
it easily.  Here's how.

Edit /etc/bash_completion.  Search for the following block of text:

# start of section containing compspecs that can be handled within bash

# user commands see only users
complete -u su usermod userdel passwd chage write chfn groups slay w

# group commands see only groups
[ -n "$bash205" ] && complete -g groupmod groupdel newgrp 2>/dev/null
  

Comment out those lines.  (They may be great with systems where root
commands are executed via "su", but they just mess things up on
"sudo"-systems.) Log out and back in to effect changes.  Bash-completion
should now work for root-only executables while in user mode.

-- 

_______________________________________
Art Alexion
Arthur S. Alexion LLC
arthur [at] alexion [dot] com
aim: aalexion
sms: 2679725536 [at] messaging [dot] sprintpcs [dot] com

PGP fingerprint: 52A4 B10C AA73 096F A661  92D2 3B65 8EAC ACC5 BA7A
The attachment -- signature.asc -- is my electronic signature; no need for alarm.
Info @ http://mysite.verizon.net/art.alexion/encryption/signature.asc.what.html

Key for signed PDFs available at
http://mysite.verizon.net/art.alexion/encryption/ArthurSAlexion.p7c
The validation string is TTJY-ZILJ-BJJG.
________________________________________

Attachment: signature.asc
Description: OpenPGP digital signature

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug