summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
Diffstat (limited to 'Completion')
-rwxr-xr-xCompletion/Unix/Command/_modutils9
1 files changed, 4 insertions, 5 deletions
diff --git a/Completion/Unix/Command/_modutils b/Completion/Unix/Command/_modutils
index 42481834b..1a725e511 100755
--- a/Completion/Unix/Command/_modutils
+++ b/Completion/Unix/Command/_modutils
@@ -1,19 +1,18 @@
 #compdef modprobe rmmod
 
-local loaded
+local expl loaded
 
 _modutils_loaded_modules() {
 
-if [[ -f /proc/modules ]]; then
+if [[ -r /proc/modules ]]; then
  loaded=(${${(f)"$(</proc/modules)"}%% *})
 elif [[ -x /sbin/lsmod ]]; then
- loaded=(${${${(f)"$(</sbin/lsmod)"}%% *}%Module})
+ loaded=(${${(f)"$(/sbin/lsmod)"}[2,-1]%% *})
 else
  return 1
 fi
 
-compadd -a loaded
-return 0
+_wanted modules expl 'loaded module' compadd -a loaded
 }
 
 case "$service" in