Dotfiles.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

95 lines
3.0 KiB

#!/bin/bash ####################################################################
#
# Создан: Ср 14 авг 2013 12:07:22
# Изменён: Ср 28 авг 2013 15:08:21
#
################################################################################
# Дополнение команд ------------------------------------------------------------
complete -W "accounts computer config continue file \
group help helpmsg localgroup name pause print \
send session share start statistics stop time use user view" \
net
#Компоненты Панели управления Windows
complete -W 'access appwiz desk directx hdwwiz intl \
inetcpl joy mmsys ncpa netsetup odbccp32 \
powercfg sysdm timedate teltphon wuaucpl wscui' \
cpl
#Оснастки Windows
complete -W 'compmgmt gpedit dsa ciadv certmgr devmgmt \
dfrg diskmgmt eventvwr fsmgmt ntmsmgr ntmsoprq \
perfmon lusrmgr rsop services secpol wmimgmt' \
msc
complete -W "boot config continue control create delete description \
enumdepend failure failureflag getdisplayname getkeyname \
interrogate lock pause qc qdescription qfailure query \
queryex querylock sdset sdshow start stop" \
sc
#Запуск сервисов
_sc_start() {
if [[ $2 == "" ]]; then
COMPREPLY=($(sc query type= service state= inactive | grep SERVICE_NAME | cut -d ':' -f 2- ))
else
COMPREPLY=($(sc query type= service state= inactive | grep SERVICE_NAME | cut -d ':' -f 2- | grep $2 ))
fi
}
complete -F _sc_start sc_start
#Приостановление и остановка работы сервисов
_sc_set_status() {
if [[ $2 == "" ]]; then
COMPREPLY=($(sc query type= service state= all | grep SERVICE_NAME | cut -d ':' -f 2- ))
else
COMPREPLY=($(sc query type= service state= all | grep SERVICE_NAME | cut -d ':' -f 2- | grep $2 ))
fi
}
complete -F _sc_set_status sc_stop sc_pause sc_continue
#Дополнение имён хостов --------------------------------------------------------
#Подключение по rdp
_rdp () {
if [[ $2 == "" ]]; then
COMPREPLY=($(echo "cb\nts\nms\n$(qappsrv | tail -n +3 | tr '
' ' ')"))
else
COMPREPLY=($(echo "cb\nts\nms\n$(qappsrv | tail -n +3 | tr '
' ' ')" | grep -i $2))
fi
}
complete -F _rdp rdp
#Подключение по vnc
_vnc() {
if [[ $2 == "" ]]; then
COMPREPLY=($(net view | grep -o '^\\\\[^[:space:]]*' | sed 's/^\\\\//'))
else
COMPREPLY=($(net view | grep -o '^\\\\[^[:space:]]*' | sed 's/^\\\\//' | grep "$2"))
fi
}
complete -F _vnc vnc
#Прочее ------------------------------------------------------------------------
#Дополнение wiki-страниц.
#Рабочая wiki небольшая, все файлы расположены в корне директории
_wiki() {
wikidir="//file-srv/homedir$/$(whoami)/wiki/"
if [[ $2 == "" ]]; then
COMPREPLY=($(\ls -1 ${wikidir}/*.html | sed 's/^.*\/\(.*\)\.html$/\1/; s/ /_/g'))
else
COMPREPLY=($(\ls -1 ${wikidir}/*.html | sed 's/^.*\/\(.*\)\.html$/\1/; s/ /_/g' | grep "^$2"))
fi
}
complete -F _wiki wiki