[go: up one dir, main page]

File: bash_completion

package info (click to toggle)
file-rc 0.8.7
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 308 kB
  • ctags: 37
  • sloc: sh: 1,835; makefile: 48
file content (28 lines) | stat: -rw-r--r-- 699 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# -*- mode: shell-script -*-
#
# Debian GNU/Linux invoke-rc.d(8) completion.
# Copyright (c) 2003  Jrg Sommer <joerg@alea.gnuu.de>
#
# $Id: bash_completion,v 1.1 2003/08/29 15:06:28 roland Exp $

have invoke-rc.d &&
_invoke_rcd()
{
    if [ $(basename $3) == invoke-rc.d ]; then
	  COMPREPLY=($(find /etc/init.d -maxdepth 1 -type f \
			    -perm +0111 -name "$2*" -printf '%f\n'))
    else
       if [ -z $2 ]; then
	  COMPREPLY=(start stop restart reload force-reload)
       else
	  k=0
	  for i in start stop restart reload force-reload; do
	     case $i in
		$2*) COMPREPLY[$k]=$i; k=$(($k+1));;
	     esac
	  done
       fi
    fi
}

[ -n "${have:-}" ] && complete -F _invoke_rcd invoke-rc.d