# Linux insmod(8) completion -*- shell-script -*- proc _insmod { local cur prev words cword _init_completion || return # do filename completion for first argument if [[ $cword -eq 1 ]] { _filedir '@(?(k)o?(.gz))' } else { # do module parameter completion setglobal COMPREPLY = ''( $( compgen -W "$( PATH="$PATH:/sbin" modinfo \ -p ${words[1]} 2>/dev/null | cut -d: -f1 )" -- "$cur" ) ) } } && complete -F _insmod insmod insmod.static # ex: ts=4 sw=4 et filetype=sh