Browse Source

bash: services completion

Maxim Likhachev 5 years ago
parent
commit
4c491c2de4
  1. 12
      etc/shell/bash/bash_completion_custom

12
etc/shell/bash/bash_completion_custom

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
#!/bin/bash #########################
#
# Изменён: Ср 05 фев 2020 14:38:27
# Изменён: Чт 27 фев 2020 00:31:10
#
#complete <что дополнять> <программа>
@ -102,5 +102,15 @@ _git-commit() { @@ -102,5 +102,15 @@ _git-commit() {
fi
}
_services () {
if [[ $2 == "" ]]; then
COMPREPLY=($(\ls /etc/init.d/ | sed '/^\/.*:$/d; /^\s*$/d' 2> /dev/null))
else
COMPREPLY=($(\ls /etc/init.d/ | sed '/^\/.*:$/d; /^\s*$/d' | grep "^$2" 2> /dev/null))
fi
}
complete -F _services start stop restart
#complete -c _git-commit git g

Loading…
Cancel
Save