[Bash-completion-commits] ./current r1290: Fix awk error in "modprobe -r /" completion, extract/use _installed_modules for rmmod and modprobe -r.

Ville Skyttä ville.skytta at iki.fi
Sun Jan 25 21:40:44 UTC 2009


------------------------------------------------------------
revno: 1290
committer: Ville Skyttä <ville.skytta at iki.fi>
branch nick: current
timestamp: Sun 2009-01-25 23:40:44 +0200
message:
  Fix awk error in "modprobe -r /" completion, extract/use _installed_modules for rmmod and modprobe -r.
modified:
  bash_completion
  debian/changelog
-------------- next part --------------
=== modified file 'bash_completion'
--- a/bash_completion	2009-01-25 21:39:09 +0000
+++ b/bash_completion	2009-01-25 21:40:44 +0000
@@ -485,6 +485,14 @@
 			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 @@
 	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 @@
 	# 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
 

=== modified file 'debian/changelog'
--- a/debian/changelog	2009-01-24 19:20:58 +0000
+++ b/debian/changelog	2009-01-25 21:40:44 +0000
@@ -101,6 +101,7 @@
   * 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 at gmail.com>  Sat, 17 Jan 2009 19:01:16 +0100
 



More information about the Bash-completion-commits mailing list