Gentoo Archives: gentoo-user

From: staticsafe <me@××××××××××.ca>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] bash completion doesn't always work with sudo
Date: Sun, 06 Apr 2014 15:58:46
Message-Id: 534179AA.6050003@staticsafe.ca
In Reply to: [gentoo-user] bash completion doesn't always work with sudo by Nikos Chantziaras
1 On 4/6/2014 06:44, Nikos Chantziaras wrote:
2 > I have a problem where commands preceded by "sudo" are not always
3 > auto-completed. This happens with executables that don't have user
4 > execute permission. For example, net-analyzer/tcptraceroute installs
5 > this binary:
6 >
7 > -rws--x--- 1 root wheel 35536 Mar 8 23:32 /usr/sbin/tcptraceroute
8 >
9 > Typing:
10 >
11 > sudo tcptr[TAB]
12 >
13 > does not auto-complete. Changing the permissions:
14 >
15 > chmod a+x /usr/sbin/tcptraceroute
16 >
17 > makes it work.
18 >
19 > Is there a way to make bash-completion work without having to modify the
20 > permissions?
21 >
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 --
37 staticsafe

Replies

Subject Author
[gentoo-user] Re: bash completion doesn't always work with sudo Nikos Chantziaras <realnc@×××××.com>
Re: [gentoo-user] bash completion doesn't always work with sudo "Rockinghorse Winner (Terry)" <ny6p01@×××××.com>