Re: /etc/init.d in the default $PATH ?

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

 



* [05.Şub.07 12:47 -0500] Michel Salim:
> 2007/2/3, Jeffrey C. Ollie <jeff@xxxxxxxxxx>:
> >If you install bash-completion and then type "service TAB" it will show
> >you a list of all of the services.
> >
> One reason I did not realized bash-completion already does this is
> that you have to be root (to have /sbin in your path) for the
> tab-completion to work.

Actually you don’t need to have /sbin in $PATH. Completion works fine if
you just type “service <TAB>” or modify the completion function as
attached.

-- 
~sertaç
--- /etc/bash_completion.orig	2007-02-06 11:51:08.000000000 +0200
+++ /etc/bash_completion	2007-02-06 13:49:18.000000000 +0200
@@ -546,7 +546,7 @@
 
 	# don't complete for things like killall, ssh and mysql if it's
 	# the standalone command, rather than the init script
-	[[ ${COMP_WORDS[0]} != @(*init.d/!(functions|~)|service) ]] && return 0
+	[[ ${COMP_WORDS[0]} != @(*init.d/!(functions|~)|/sbin/service|service) ]] && return 0
 
 	# don't complete past 2nd token
 	[ $COMP_CWORD -gt 2 ] && return 0
@@ -554,7 +554,7 @@
 	[ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \
 				|| sysvdir=/etc/init.d
 
-	if [[ $COMP_CWORD -eq 1 ]] && [[ $prev == "service" ]]; then
+	if [[ $COMP_CWORD -eq 1 ]] && [[ $prev == "service" || $prev == "/sbin/service" ]]; then
 		_services
 	else
 		COMPREPLY=( $( compgen -W '`sed -ne "y/|/ /; \
-- 
fedora-devel-list mailing list
fedora-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-devel-list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux