Gentoo Archives: gentoo-user

From: "Rockinghorse Winner (Terry)" <ny6p01@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] bash completion doesn't always work with sudo
Date: Sun, 06 Apr 2014 21:51:18
Message-Id: 5341CC82.7080500@gmail.com
In Reply to: Re: [gentoo-user] bash completion doesn't always work with sudo by staticsafe
1 staticsafe wrote:
2 > On 4/6/2014 06:44, Nikos Chantziaras wrote:
3 >> I have a problem where commands preceded by "sudo" are not always
4 >> auto-completed. This happens with executables that don't have user
5 >> execute permission. For example, net-analyzer/tcptraceroute installs
6 >> this binary:
7 >>
8 >> -rws--x--- 1 root wheel 35536 Mar 8 23:32 /usr/sbin/tcptraceroute
9 >>
10 >> Typing:
11 >>
12 >> sudo tcptr[TAB]
13 >>
14 >> does not auto-complete. Changing the permissions:
15 >>
16 >> chmod a+x /usr/sbin/tcptraceroute
17 >>
18 >> makes it work.
19 >>
20 >> Is there a way to make bash-completion work without having to modify the
21 >> permissions?
22 >>
23 >>
24 > According to https://bbs.archlinux.org/viewtopic.php?id=45613:
25 > adding `complete -cf sudo` to your .bashrc will make tab completion work
26 > with sudo.
27 >
28 > Just tested:
29 > dresden ~ # complete -cf sudo
30 > dresden ~ # sudo tcp
31 > tcpd tcpdchk tcpdmatch tcpdump tcptraceroute
32 > dresden ~ # ls -alh /usr/sbin/tcptraceroute
33 > -rws--x--- 1 root wheel 35K Apr 6 15:54 /usr/sbin/tcptraceroute
34 >
35 >
36 Cool. Thanks.