Hi, Here is another script to support bash completion for invoke-rc.d, this one doesn't support options (the previous one doesn't complete successfully them) and takes the actions from each init script. I think that a combination of both scripts could be a nice option.
Thanks for your work, -- Santiago Ruano Rincón Grupo GNU/Linux de la Universidad del Cauca Huella digital llave GPG: 3821 4FB5 774A 611D 31E4 B268 414B 8423 6FEC CDE0
# Debian GNU/Linux invoke-rc.d completion
# Copyright 2005 Santiago Ruano Rincon <[EMAIL PROTECTED]>
# based on the services functions of /etc/bash_completion
# by Ian Macdonald <[EMAIL PROTECTED]>
# License: GNU GPL v2 or later
have invoke-rc.d &&
_invoke-rc.d()
{
local cur prev services sysvdir
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
sysvdir=/etc/init.d
services=$(ls --color=none $sysvdir | egrep -v '(\.dpkg-old|~)$ | egrep -v README | grep -v skeleton')
# don't complete past 2nd token
[ $COMP_CWORD -gt 2 ] && return 0
if [[ $COMP_CWORD -eq 1 ]] && [[ $prev == "invoke-rc.d" ]]; then
COMPREPLY=( $( compgen -o filenames -W "$services" $cur ) )
else
COMPREPLY=( $( compgen -W '`sed -ne "y/|/ /; \
s/^.*Usage.*{\(.*\)}.*$/\1/p" \
$sysvdir/${prev##*/}`' -- \
$cur ) )
fi
return 0
}
[ "$have" ] && complete -F _invoke-rc.d invoke-rc.d
signature.asc
Description: Esta parte del mensaje está firmada digitalmente

