Fix awk error in "modprobe -r /" completion, extract/use _installed_modules for rmmod and modprobe -r.

This commit is contained in:
Ville Skyttä 2009-01-25 23:40:44 +02:00
parent 134614341c
commit 6a2ff139a0
2 changed files with 11 additions and 4 deletions

View File

@ -485,6 +485,14 @@ _modules()
sed -ne 's/^\('$cur'.*\)\.k\?o\(\|.gz\)$/\1/p') )
}
# This function completes on installed modules
#
_installed_modules()
{
COMPREPLY=( $( compgen -W "$( /sbin/lsmod | \
awk '{if (NR != 1) print $1}' )" -- $1 ) )
}
# This function completes on user:group format
#
_usergroup()
@ -817,8 +825,7 @@ _rmmod()
COMPREPLY=()
cur=`_get_cword`
COMPREPLY=( $( /sbin/lsmod | \
awk '{if (NR != 1 && $1 ~ /^'$cur'/) print $1}' 2>/dev/null ))
_installed_modules "$cur"
return 0
}
complete -F _rmmod rmmod
@ -838,8 +845,7 @@ _insmod()
# behave like lsmod for modprobe -r
if [ $1 = "modprobe" ] &&
[ "${COMP_WORDS[1]}" = "-r" ]; then
COMPREPLY=( $( /sbin/lsmod | \
awk '{if (NR != 1 && $1 ~ /^'$cur'/) print $1}' ) )
_installed_modules "$cur"
return 0
fi

1
debian/changelog vendored
View File

@ -101,6 +101,7 @@ bash-completion (200811xx) UNRELEASED; urgency=low
* Added lzop completion.
* Fix scp metacharacter escaping.
* Remove duplicate cpio completion, thanks to Freddy Vulto (Closes: #512823)
* Fix awk error in "modprobe -r /" completion (Closes: #512556).
-- David Paleino <d.paleino@gmail.com> Sat, 17 Jan 2009 19:01:16 +0100