From d08b9f233559b3dced20050ba312b08fe0de53b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Tue, 29 Jan 2013 23:28:13 +0200 Subject: [PATCH] modprobe: Don't suggest installing already installed modules. --- completions/modprobe | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/completions/modprobe b/completions/modprobe index cf35f4b9..b59e4dca 100644 --- a/completions/modprobe +++ b/completions/modprobe @@ -77,6 +77,20 @@ _modprobe() -p "$module" 2>/dev/null | cut -d: -f1 )" -- "$cur" ) ) else _modules $version + if [[ $COMPREPLY ]]; then + # filter out already installed modules + local -a mods=( "${COMPREPLY[@]}" ) + _installed_modules "$cur" + for i in ${!mods[@]}; do + for module in ${COMPREPLY[@]}; do + if [[ ${mods[i]} == $module ]]; then + unset mods[i] + break + fi + done + done + COMPREPLY=( "${mods[@]}" ) + fi fi ;; esac