On 4/6/2014 06:44, Nikos Chantziaras wrote:
> I have a problem where commands preceded by "sudo" are not always
> auto-completed. This happens with executables that don't have user
> execute permission. For example, net-analyzer/tcptraceroute installs
> this binary:
> 
>  -rws--x--- 1 root wheel 35536 Mar  8 23:32 /usr/sbin/tcptraceroute
> 
> Typing:
> 
>   sudo tcptr[TAB]
> 
> does not auto-complete. Changing the permissions:
> 
>   chmod a+x /usr/sbin/tcptraceroute
> 
> makes it work.
> 
> Is there a way to make bash-completion work without having to modify the
> permissions?
> 
> 

According to https://bbs.archlinux.org/viewtopic.php?id=45613:
adding `complete -cf sudo` to your .bashrc will make tab completion work
with sudo.

Just tested:
dresden ~ # complete -cf sudo
dresden ~ # sudo tcp
tcpd           tcpdchk        tcpdmatch      tcpdump        tcptraceroute
dresden ~ # ls -alh /usr/sbin/tcptraceroute
-rws--x--- 1 root wheel 35K Apr  6 15:54 /usr/sbin/tcptraceroute


-- 
staticsafe

Reply via email to