From 639e80622b3e3c4db3c4a3ca035ef6f732cb797a Mon Sep 17 00:00:00 2001 From: Iain Patterson Date: Thu, 19 Oct 2006 10:24:30 +0000 Subject: [PATCH] Added modprobe and rmmmod completions. git-svn-id: https://svn.cambridge.iain.cx/profile/trunk@32 6be0d1a5-5cfe-0310-89b6-964be062b18b --- .profile.d/completion.bashrc | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.profile.d/completion.bashrc b/.profile.d/completion.bashrc index 663b56d..fbec144 100644 --- a/.profile.d/completion.bashrc +++ b/.profile.d/completion.bashrc @@ -80,6 +80,29 @@ function _make() { return 0 } +# Look for modules. +function _modprobe() { + COMPREPLY=() + cur=${COMP_WORDS[COMP_CWORD]} + + ver=$(uname -r) + MODULES="$(find /lib/modules/$ver -name \*.ko | sed -n 's@^.*/\([^/]*\).ko$@\1@p')" + + COMPREPLY=($(compgen -W "$MODULES" -- "$cur")) + return 0 +} + +# Look for loaded modules. +function _rmmod() { + COMPREPLY=() + cur=${COMP_WORDS[COMP_CWORD]} + + MODULES="$(lsmod | sed '1d;s/ .*$//')" + + COMPREPLY=($(compgen -W "$MODULES" -- "$cur")) + return 0 +} + complete -F _ssh rollout complete -F _ssh ssh complete -F _ssh sshterm @@ -94,3 +117,5 @@ complete -F _process killall complete -F _pid kill complete -F _pid strace complete -F _known_hosts kill_known_host +complete -F _modprobe modprobe +complete -F _rmmod rmmod -- 2.20.1