[Bash-completion-commits] [SCM] bash-completion branch, master, updated. e0feeacd5498c25e2c7a37b1775e695e0cb4828d

Freddy Vulto fvulto at gmail.com
Fri Sep 25 07:39:22 UTC 2009


The following commit has been merged in the master branch:
commit cfcf9fae8fbd79350829b2917f9fa40a32beb7d9
Author: Freddy Vulto <fvulto at gmail.com>
Date:   Fri Sep 25 09:36:29 2009 +0200

    Quote unquoted $cur to prevent globbing.
    Closes Alioth #311614
    
    Globbing might occur if $cur contains one of these globbing characters: * ? [ ]
    
    The bug becomes apparent:
    
    On Cygwin if the glob-string contains backslashes as well, causing a warning (Cygwin >= 1.7):
    
        MS-DOS style path detected: ...
        Preferred POSIX equivalent is: ...
        CYGWIN environment variable option "nodosfilewarning" turns off this warning.
        Consult the user's guide for more details about POSIX paths:
          http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
    
    On Linux, using strace, you can see bash-completion doing an unnecessary `open' system call.
    
    Steps to reproduce on Linux using `strace':
    
    Environment:  Linux, bash-completion-1.0
    
    1.  Start bash with bash-completion loaded and find out PID ($$):
    
        $ echo $$
        MYPID
    
    2.  In a second bash shell, `strace' the above PID:
    
        $ strace -e trace=open -f -o strace.log -p MYPID
    
    3.  Within the first bash shell, type:
    
        $ cur="?"; _kernel_versions
    
    4.  In the second bash shell, type ^C to quick `strace'.
    
    5.  Check `strace.log', here you can see bash accessing
        something it shouldn't:
    
        ...
        open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
        ...
    
    6.  The above call to `open' disappears if $cur in _kernel_versions gets
        quoted, and you repeat the steps above:
    
        _kernel_versions()
        {
            COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- "$cur" ) )
        }

diff --git a/bash_completion b/bash_completion
index 46ef492..0df496e 100644
--- a/bash_completion
+++ b/bash_completion
@@ -475,17 +475,17 @@ _configured_interfaces()
 		# SuSE system
 		COMPREPLY=( $( command ls \
 			/etc/sysconfig/network/ifcfg-* | \
-			sed -ne 's|.*ifcfg-\('$cur'.*\)|\1|p' ) )
+			sed -ne 's|.*ifcfg-\('"$cur"'.*\)|\1|p' ) )
 	elif [ -f /etc/pld-release ]; then
 		# PLD Linux
 		COMPREPLY=( $( command ls -B \
 			/etc/sysconfig/interfaces | \
-			sed -ne 's|.*ifcfg-\('$cur'.*\)|\1|p' ) )
+			sed -ne 's|.*ifcfg-\('"$cur"'.*\)|\1|p' ) )
 	else
 		# Assume Red Hat
 		COMPREPLY=( $( command ls \
 			/etc/sysconfig/network-scripts/ifcfg-* | \
-			sed -ne 's|.*ifcfg-\('$cur'.*\)|\1|p' ) )
+			sed -ne 's|.*ifcfg-\('"$cur"'.*\)|\1|p' ) )
 	fi
 }
 
@@ -493,7 +493,7 @@ _configured_interfaces()
 #
 _kernel_versions()
 {
-	COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- $cur ) )
+	COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- "$cur" ) )
 }
 
 # This function completes on all available network interfaces
@@ -513,7 +513,7 @@ _available_interfaces()
 	fi
 
 	COMPREPLY=( $( eval $cmd 2>/dev/null | \
-		sed -ne 's|^\('$cur'[^[:space:][:punct:]]\{1,\}\).*$|\1|p') )
+		sed -ne 's|^\('"$cur"'[^[:space:][:punct:]]\{1,\}\).*$|\1|p') )
 }
 
 # This function expands tildes in pathnames
@@ -531,7 +531,7 @@ _expand()
 		eval cur=$cur
 	elif [[ "$cur" == \~* ]]; then
 		cur=${cur#\~}
-		COMPREPLY=( $( compgen -P '~' -u $cur ) )
+		COMPREPLY=( $( compgen -P '~' -u "$cur" ) )
 		[ ${#COMPREPLY[@]} -eq 1 ] && eval COMPREPLY[0]=${COMPREPLY[0]}
 		return ${#COMPREPLY[@]}
 	fi
@@ -542,11 +542,11 @@ _expand()
 [ $UNAME = SunOS -o $UNAME = AIX ] &&
 _pids()
 {
-	COMPREPLY=( $( compgen -W '$( command ps -efo pid | sed 1d )' -- $cur ))
+	COMPREPLY=( $( compgen -W '$( command ps -efo pid | sed 1d )' -- "$cur" ))
 } ||
 _pids()
 {
-	COMPREPLY=( $( compgen -W '$( command ps axo pid= )' -- $cur ) )
+	COMPREPLY=( $( compgen -W '$( command ps axo pid= )' -- "$cur" ) )
 }
 
 # This function completes on process group IDs.
@@ -554,11 +554,11 @@ _pids()
 [ $UNAME = SunOS -o $UNAME = AIX ] &&
 _pgids()
 {
-	COMPREPLY=( $( compgen -W '$( command ps -efo pgid | sed 1d )' -- $cur ))
+	COMPREPLY=( $( compgen -W '$( command ps -efo pgid | sed 1d )' -- "$cur" ))
 } ||
 _pgids()
 {
-	COMPREPLY=( $( compgen -W '$( command ps axo pgid= )' -- $cur ))
+	COMPREPLY=( $( compgen -W '$( command ps axo pgid= )' -- "$cur" ))
 }
 
 # This function completes on process names.
@@ -569,7 +569,7 @@ _pnames()
 	COMPREPLY=( $( compgen -W '$( command ps -efo comm | \
 			           sed -e 1d -e "s:.*/::" -e "s/^-//" \
 				       -e "s/^<defunct>$//")' \
-			           -- $cur ) )
+			           -- "$cur" ) )
 } ||
 _pnames()
 {
@@ -585,7 +585,7 @@ _pnames()
 			           sed -e "s/ .*//; s:.*/::; s/:$//;" \
 			               -e "s/^[[(-]//; s/[])]$//" \
 				       -e "s/^<defunct>$//")' \
-			           -- $cur ) )
+			           -- "$cur" ) )
 }
 
 # This function completes on user IDs
@@ -593,12 +593,12 @@ _pnames()
 _uids()
 {
 	if type getent &>/dev/null; then
-	    COMPREPLY=( $( compgen -W '$( getent passwd | cut -d: -f3 )' -- $cur ) )
+	    COMPREPLY=( $( compgen -W '$( getent passwd | cut -d: -f3 )' -- "$cur" ) )
 	elif type perl &>/dev/null; then
-	    COMPREPLY=( $( compgen -W '$( perl -e '"'"'while (($uid) = (getpwent)[2]) { print $uid . "\n" }'"'"' )' -- $cur ) )
+	    COMPREPLY=( $( compgen -W '$( perl -e '"'"'while (($uid) = (getpwent)[2]) { print $uid . "\n" }'"'"' )' -- "$cur" ) )
 	else
 	    # make do with /etc/passwd
-	    COMPREPLY=( $( compgen -W '$( cut -d: -f3 /etc/passwd )' -- $cur ) )
+	    COMPREPLY=( $( compgen -W '$( cut -d: -f3 /etc/passwd )' -- "$cur" ) )
 	fi
 }
 
@@ -608,12 +608,12 @@ _gids()
 {
 	if type getent &>/dev/null; then
 	    COMPREPLY=( $( getent group | \
-			    awk -F: '{if ($3 ~ /^'$cur'/) print $3}' ) )
+			    awk -F: '{if ($3 ~ /^'"$cur"'/) print $3}' ) )
 	elif type perl &>/dev/null; then
-	    COMPREPLY=( $( compgen -W '$( perl -e '"'"'while (($gid) = (getgrent)[2]) { print $gid . "\n" }'"'"' )' -- $cur ) )
+	    COMPREPLY=( $( compgen -W '$( perl -e '"'"'while (($gid) = (getgrent)[2]) { print $gid . "\n" }'"'"' )' -- "$cur" ) )
 	else
 	    # make do with /etc/group
-	    COMPREPLY=( $( awk 'BEGIN {FS=":"} {if ($3 ~ /^'$cur'/) print $3}'\
+	    COMPREPLY=( $( awk 'BEGIN {FS=":"} {if ($3 ~ /^'"$cur"'/) print $3}'\
 			    /etc/group ) )
 	fi
 }
@@ -631,7 +631,7 @@ _services()
 		COMPREPLY=( "${COMPREPLY[@]}" $( builtin echo $famdir/!(*.rpm@(orig|new|save)|*~)) )
 	fi
 
-	COMPREPLY=( $( compgen -W '${COMPREPLY[@]#@($sysvdir|$famdir)/}' -- $cur ) )
+	COMPREPLY=( $( compgen -W '${COMPREPLY[@]#@($sysvdir|$famdir)/}' -- "$cur" ) )
 }
 
 # This function completes on modules
@@ -641,7 +641,7 @@ _modules()
 	local modpath
 	modpath=/lib/modules/$1
 	COMPREPLY=( $( command ls -R $modpath | \
-			sed -ne 's/^\('$cur'.*\)\.k\?o\(\|.gz\)$/\1/p') )
+			sed -ne 's/^\('"$cur"'.*\)\.k\?o\(\|.gz\)$/\1/p') )
 }
 
 # This function completes on installed modules
@@ -664,7 +664,7 @@ _usergroup()
 	elif [[ $cur = *:* ]] && [ -n "$bash205" ]; then
 		COMPREPLY=( $( compgen -g -- ${cur##*[.:]} ) )
 	else
-		COMPREPLY=( $( compgen -S : -u -- $cur ) )
+		COMPREPLY=( $( compgen -S : -u -- "$cur" ) )
 	fi
 }
 
@@ -673,7 +673,7 @@ _usergroup()
 _shells()
 {
 	COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W '$( grep "^[[:space:]]*/" \
-			/etc/shells 2>/dev/null )' -- $cur ) )
+			/etc/shells 2>/dev/null )' -- "$cur" ) )
 }
 
 # Get real command.
@@ -711,7 +711,7 @@ _count_args()
 _pci_ids()
 {
 	COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W \
-		"$( PATH="$PATH:/sbin" lspci -n | awk '{print $3}')" -- $cur ) )
+		"$( PATH="$PATH:/sbin" lspci -n | awk '{print $3}')" -- "$cur" ) )
 }
 
 # This function completes on USB IDs
@@ -719,7 +719,7 @@ _pci_ids()
 _usb_ids()
 {
 	COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W \
-		"$( PATH="$PATH:/sbin" lsusb | awk '{print $6}' )" -- $cur ) )
+		"$( PATH="$PATH:/sbin" lsusb | awk '{print $6}' )" -- "$cur" ) )
 }
 
 # start of section containing completion functions for external programs
@@ -757,7 +757,7 @@ _service()
 	else
 		COMPREPLY=( $( compgen -W '`sed -ne "y/|/ /; \
 				s/^.*\(U\|msg_u\)sage.*{\(.*\)}.*$/\1/p" \
-				$sysvdir/${prev##*/} 2>/dev/null`' -- $cur ) )
+				$sysvdir/${prev##*/} 2>/dev/null`' -- "$cur" ) )
 	fi
 
 	return 0
@@ -793,7 +793,7 @@ _chown()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-c -h -f -R -v --changes \
 		--dereference --no-dereference --from --silent --quiet \
-		--reference --recursive --verbose --help --version' -- $cur ) )
+		--reference --recursive --verbose --help --version' -- "$cur" ) )
 	else
 		_count_args
 
@@ -833,7 +833,7 @@ _chgrp()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-c -h -f -R -v --changes \
 		--dereference --no-dereference --silent --quiet \
-		--reference --recursive --verbose --help --version' -- $cur ) )
+		--reference --recursive --verbose --help --version' -- "$cur" ) )
 		return 0
 	fi
 
@@ -841,7 +841,7 @@ _chgrp()
 	if [ $COMP_CWORD -eq 1 ] && [[ "$cur" != -* ]] || \
 	   [[ "$prev" == -* ]] && [ -n "$bash205" ]; then
 		local IFS=$'\n'
-		COMPREPLY=( $( compgen -g $cur 2>/dev/null ) )
+		COMPREPLY=( $( compgen -g "$cur" 2>/dev/null ) )
 	else
 		_filedir || return 0
 	fi
@@ -860,7 +860,7 @@ _umount()
 	COMPREPLY=()
 	cur=`_get_cword`
 
-	COMPREPLY=( $( compgen -W '$( mount | cut -d" " -f 3 )' -- $cur ) )
+	COMPREPLY=( $( compgen -W '$( mount | cut -d" " -f 3 )' -- "$cur" ) )
 
 	return 0
 }
@@ -896,18 +896,18 @@ _mount()
 		fi
 	elif [ -r /etc/vfstab ]; then
 		# Solaris
-		COMPREPLY=( $( compgen -W "$( awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' /etc/vfstab )" -- $cur ) )
+		COMPREPLY=( $( compgen -W "$( awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' /etc/vfstab )" -- "$cur" ) )
 	elif [ ! -e /etc/fstab ]; then
 		# probably Cygwin
-		COMPREPLY=( $( compgen -W "$( mount | awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' )" -- $cur ) )
+		COMPREPLY=( $( compgen -W "$( mount | awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' )" -- "$cur" ) )
 	else
 		# probably Linux
 		if [ $prev = -L ]; then
-			COMPREPLY=( $( compgen -W '$(sed -ne "s/^[[:space:]]*LABEL=\([^[:space:]]*\).*/\1/p" /etc/fstab )' -- $cur ) )
+			COMPREPLY=( $( compgen -W '$(sed -ne "s/^[[:space:]]*LABEL=\([^[:space:]]*\).*/\1/p" /etc/fstab )' -- "$cur" ) )
 		elif [ $prev = -U ]; then
-			COMPREPLY=( $( compgen -W '$(sed -ne "s/^[[:space:]]*UUID=\([^[:space:]]*\).*/\1/p" /etc/fstab )' -- $cur ) )
+			COMPREPLY=( $( compgen -W '$(sed -ne "s/^[[:space:]]*UUID=\([^[:space:]]*\).*/\1/p" /etc/fstab )' -- "$cur" ) )
 		else
-			COMPREPLY=( $( compgen -W "$( awk '! /^[ \t]*#/ {if ($2 ~ /\//) print $2}' /etc/fstab )" -- $cur ) )
+			COMPREPLY=( $( compgen -W "$( awk '! /^[ \t]*#/ {if ($2 ~ /\//) print $2}' /etc/fstab )" -- "$cur" ) )
 		fi
 	fi
 
@@ -987,7 +987,7 @@ _renice()
 		curopt=${COMP_WORDS[COMP_CWORD-$i]}
 		case "$curopt" in
 		-u)
-			COMPREPLY=( $( compgen -u -- $cur ) )
+			COMPREPLY=( $( compgen -u -- "$cur" ) )
 			;;
 		-g)
 			_pgids
@@ -1095,7 +1095,7 @@ _ipsec()
 		COMPREPLY=( $( compgen -W 'auto barf eroute klipsdebug look \
 					   manual pluto ranbits rsasigkey \
 					   setup showdefaults showhostkey spi \
-					   spigrp tncfg whack' -- $cur ) )
+					   spigrp tncfg whack' -- "$cur" ) )
 		return 0
 	fi
 
@@ -1104,18 +1104,18 @@ _ipsec()
 		COMPREPLY=( $( compgen -W '--asynchronous --up --add --delete \
 					   --replace --down --route --unroute \
 					   --ready --status --rereadsecrets' \
-					-- $cur ) )
+					-- "$cur" ) )
 		;;
 	manual)
 		COMPREPLY=( $( compgen -W '--up --down --route --unroute \
-					   --union' -- $cur ) )
+					   --union' -- "$cur" ) )
 		;;
 	ranbits)
 		COMPREPLY=( $( compgen -W '--quick --continuous --bytes' \
 					  -- $cur ) )
 		;;
 	setup)
-		COMPREPLY=( $( compgen -W '--start --stop --restart' -- $cur ) )
+		COMPREPLY=( $( compgen -W '--start --stop --restart' -- "$cur" ) )
 		;;
 
 	*)
@@ -1294,7 +1294,7 @@ _known_hosts_real()
 		# append any available aliases from config files
 		if [ ${#config[@]} -gt 0 ] && [ -n "$aliases" ]; then
 			local host_aliases=$( sed -ne 's/^[ \t]*[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\?['"$'\t '"']\+\([^#*?]*\)\(#.*\)\?$/\2/p' "${config[@]}" )
-			hosts=$( compgen -W "$host_aliases" -- $cur )
+			hosts=$( compgen -W "$host_aliases" -- "$cur" )
 				COMPREPLY=( "${COMPREPLY[@]}" $hosts )
 		fi
 
@@ -1309,7 +1309,7 @@ _known_hosts_real()
 			if [ -n "$(pidof avahi-daemon)" ]; then
 				COMPREPLY=( "${COMPREPLY[@]}" $(
 					compgen -W "$( avahi-browse -cpr _workstation._tcp | \
-					grep ^= | cut -d\; -f7 | sort -u )" -- $cur ) )
+					grep ^= | cut -d\; -f7 | sort -u )" -- "$cur" ) )
 			fi
 		fi
 
@@ -1322,7 +1322,7 @@ _known_hosts_real()
 	# Add results of normal hostname completion, unless `COMP_KNOWN_HOSTS_WITH_HOSTFILE'
 	# is set to an empty value.
 	if [ -n "${COMP_KNOWN_HOSTS_WITH_HOSTFILE-1}" ]; then
-		COMPREPLY=( "${COMPREPLY[@]}" $( compgen -A hostname -P "$prefix$user" -S "$suffix" -- $cur ) )
+		COMPREPLY=( "${COMPREPLY[@]}" $( compgen -A hostname -P "$prefix$user" -S "$suffix" -- "$cur" ) )
 	fi
 
 	return 0
@@ -1441,7 +1441,7 @@ _command_offset()
 	cur=`_get_cword`
 
 	if [[ $COMP_CWORD -eq 0 ]]; then
-		COMPREPLY=( $( compgen -c -- $cur ) )
+		COMPREPLY=( $( compgen -c -- "$cur" ) )
 	else
 		cmd=${COMP_WORDS[0]}
 		if complete -p $cmd &>/dev/null; then
@@ -1510,7 +1510,7 @@ _longopt()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W "$( $1 --help 2>&1 | sed -e '/--/!d' \
 				-e 's/.*\(--[-A-Za-z0-9]\+\).*/\1/' |sort -u )"\
-				-- $cur ) )
+				-- "$cur" ) )
 	elif [[ "$1" == rmdir ]]; then
 		_filedir -d
 	else
@@ -1561,9 +1561,9 @@ _id()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-a -g --group -G --groups -n --name\
-			-r --real -u --user --help --version' -- $cur ) )
+			-r --real -u --user --help --version' -- "$cur" ) )
 	else
-		COMPREPLY=( $( compgen -u $cur  ) )
+		COMPREPLY=( $( compgen -u "$cur" ) )
 	fi
 } &&
 complete -F _id id
diff --git a/contrib/ant b/contrib/ant
index 8641705..0cb504a 100644
--- a/contrib/ant
+++ b/contrib/ant
@@ -27,7 +27,7 @@ _ant()
 			;;
 		-nice)
 			COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9 10' \
-				-- $cur ) )
+				-- "$cur" ) )
 			return 0
 			;;
 		-lib|-logger|-listener|-D|-inputhandler|-main)
@@ -41,7 +41,7 @@ _ant()
 			-lib -logfile -l -logger -listener -noinput -buildfile \
 			-file -f -D -keep-going -k -propertyfile -inputhandler \
 			-find -s -nice -nouserlib -noclasspath -autoproxy \
-			-main' -- $cur ) )
+			-main' -- "$cur" ) )
 	else
 		# available targets completion
 		# find which buildfile to use
@@ -60,7 +60,7 @@ _ant()
 		COMPREPLY=( $( compgen -W "$( cat $buildfile | \
 			tr "'\t\n>" "\"  \n" | \
 			sed -ne 's/.*<target .*name="\([^"]*\).*/\1/p' \
-			2>/dev/null )" -- $cur ) )
+			2>/dev/null )" -- "$cur" ) )
 	fi
 }
 have complete-ant-cmd.pl && \
diff --git a/contrib/apt b/contrib/apt
index b816a6d..c902a0a 100644
--- a/contrib/apt
+++ b/contrib/apt
@@ -32,7 +32,7 @@ _apt_get()
 			return 0
 			;;
 		*)
-			COMPREPLY=( $( apt-cache --no-generate pkgnames $cur 2> /dev/null ) )
+			COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" 2> /dev/null ) )
 			return 0
 			;;
 
@@ -68,12 +68,12 @@ _apt_get()
 				--list-cleanup --default-release \
 				--trivial-only --no-remove --diff-only \
 				--no-install-recommends \
-				--tar-only --config-file --option --auto-remove' -- $cur ) )
+				--tar-only --config-file --option --auto-remove' -- "$cur" ) )
 	else
 
 		COMPREPLY=( $( compgen -W 'update upgrade dselect-upgrade \
 				dist-upgrade install remove purge source build-dep \
-				check clean autoclean autoremove' -- $cur ) )
+				check clean autoclean autoremove' -- "$cur" ) )
 
 	fi
 
@@ -118,7 +118,7 @@ _apt_cache()
 			;;
 
  		*)
-		    COMPREPLY=( $( apt-cache --no-generate pkgnames $cur 2> /dev/null ) )
+		    COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" 2> /dev/null ) )
 		    return 0
 		    ;;
 
@@ -145,13 +145,13 @@ _apt_cache()
 				--quiet --important --full --all-versions \
 				--no-all-versions --generate --no-generate \
 				--names-only --all-names --recurse \
-				--config-file --option --installed' -- $cur ) )
+				--config-file --option --installed' -- "$cur" ) )
 	else
 
 		COMPREPLY=( $( compgen -W 'add gencaches show showpkg showsrc \
 				stats dump dumpavail unmet search search \
 				depends rdepends pkgnames dotty xvcg \
-				policy madison' -- $cur ) )
+				policy madison' -- "$cur" ) )
 
 	fi
 
diff --git a/contrib/apt-build b/contrib/apt-build
index d250117..ca3f2b2 100644
--- a/contrib/apt-build
+++ b/contrib/apt-build
@@ -21,12 +21,12 @@ _apt_build()
 	if [ -n "$special" ]; then
 		case $special in
 		@(install|source|info))
-			COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) )
+			COMPREPLY=( $( apt-cache pkgnames "$cur" 2> /dev/null ) )
 			return 0
 			;;
 		remove)
 			COMPREPLY=( $( _comp_dpkg_installed_packages \
-					$cur ) )
+					"$cur" ) )
 			return 0
 			;;
 		*)
@@ -54,12 +54,12 @@ _apt_build()
 				  --build-command --reinstall --rebuild \
 				  --remove-builddep --no-wrapper --purge \
 				  --patch --patch-strip -p --yes -y \
-				  --version -v --no-source' -- $cur ) )
+				  --version -v --no-source' -- "$cur" ) )
 
 	else
 	    COMPREPLY=( $( compgen -W 'update upgrade install remove \
 				  source dist-upgrade world clean info \
-				  clean-build update-repository ' -- $cur ) )
+				  clean-build update-repository ' -- "$cur" ) )
 	fi
 
 
diff --git a/contrib/aptitude b/contrib/aptitude
index 7d710c5..526f132 100644
--- a/contrib/aptitude
+++ b/contrib/aptitude
@@ -50,11 +50,11 @@ _aptitude()
 		   return 0
 		   ;;
 	       @(purge|remove|reinstall|forbid-version))
-  		   COMPREPLY=( $( _comp_dpkg_installed_packages $cur ) )
+  		   COMPREPLY=( $( _comp_dpkg_installed_packages "$cur" ) )
 		   return 0
 		   ;;
 	       unhold)
-  		   COMPREPLY=( $( _comp_dpkg_hold_packages $cur ) )
+  		   COMPREPLY=( $( _comp_dpkg_hold_packages "$cur" ) )
 		   return 0
 		   ;;
 
@@ -82,13 +82,13 @@ _aptitude()
 	esac
 
 	if [[ "$cur" == -* ]]; then
-	    COMPREPLY=( $( compgen -W "$dashoptions" -- $cur ) )
+	    COMPREPLY=( $( compgen -W "$dashoptions" -- "$cur" ) )
 	else
 	    COMPREPLY=( $( compgen -W 'update upgrade safe-upgrade forget-new clean \
 				       autoclean install reinstall remove \
 				       hold unhold purge markauto unmarkauto why why-not \
 				       dist-upgrade full-upgrade download search show \
-				       forbid-version changelog keep-all build-dep' -- $cur ) )
+				       forbid-version changelog keep-all build-dep' -- "$cur" ) )
 	fi
 
 
diff --git a/contrib/aspell b/contrib/aspell
index 14e9628..5ddb1e7 100644
--- a/contrib/aspell
+++ b/contrib/aspell
@@ -14,7 +14,7 @@ _aspell_dictionary()
 	COMPREPLY=( ${COMPREPLY[@]#$datadir/} )
 	# Then, add the canonical dicts
 	COMPREPLY=( "${COMPREPLY[@]}" $( aspell dicts 2>/dev/null ) )
-	COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- $cur ) )
+	COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
 }
 
 _aspell()
@@ -37,19 +37,19 @@ _aspell()
 			return 0
 			;;
 		dump|create|merge)
-			COMPREPLY=( $( compgen -W 'master personal repl' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'master personal repl' -- "$cur" ) )
 			return 0
 			;;
 		--mode)
-			COMPREPLY=( $( compgen -W 'none url email sgml tex' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'none url email sgml tex' -- "$cur" ) )
 			return 0
 			;;
 		--sug-mode)
-			COMPREPLY=( $( compgen -W 'ultra fast normal bad-speller' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'ultra fast normal bad-speller' -- "$cur" ) )
 			return 0
 			;;
 		--keymapping)
-			COMPREPLY=( $( compgen -W 'aspell ispell' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'aspell ispell' -- "$cur" ) )
 			return 0
 			;;
 		-d|--master)
@@ -81,11 +81,11 @@ _aspell()
 			--rem-tex-command --tex-check-comments \
 			--dont-tex-check-comments --add-tex-extension \
 			--rem-tex-extension --add-sgml-check --rem-sgml-check \
-			--add-sgml-extension --rem-sgml-extension' -- $cur ) )
+			--add-sgml-extension --rem-sgml-extension' -- "$cur" ) )
 	else
 		COMPREPLY=( $( compgen -W '-? help -c check -a pipe -l list \
 			config config soundslike filter -v version dump \
-			create merge' -- $cur ) )
+			create merge' -- "$cur" ) )
 	fi
 
 }
diff --git a/contrib/autorpm b/contrib/autorpm
index b773347..c53acec 100644
--- a/contrib/autorpm
+++ b/contrib/autorpm
@@ -13,7 +13,7 @@ _autorpm()
 
 	COMPREPLY=( $( compgen -W '--notty --debug --help --version \
 				   auto add fullinfo info help install list \
-				   remove set' -- $cur ) )
+				   remove set' -- "$cur" ) )
 
 } &&
 complete -F _autorpm autorpm
diff --git a/contrib/bash-builtins b/contrib/bash-builtins
index 9607516..c514bf6 100644
--- a/contrib/bash-builtins
+++ b/contrib/bash-builtins
@@ -14,7 +14,7 @@ _alias()
 
 	case "$COMP_LINE" in
 	*[^=])
-		COMPREPLY=( $( compgen -A alias -- $cur ) )
+		COMPREPLY=( $( compgen -A alias -- "$cur" ) )
 		;;
 	*=)
 		COMPREPLY=( "$( alias ${cur%=} 2>/dev/null | \
@@ -35,10 +35,10 @@ _export()
 
 	case "$COMP_LINE" in
 	*=\$*)
-		COMPREPLY=( $( compgen -v -P '$' -- ${cur#*=\$} ) )
+		COMPREPLY=( $( compgen -v -P '$' -- "${cur#*=\$}" ) )
 		;;
 	*[^=])
-		COMPREPLY=( $( compgen -v -S '=' -- $cur ) )
+		COMPREPLY=( $( compgen -v -S '=' -- "$cur" ) )
 		;;
 	*=)
 		COMPREPLY=( "$( eval echo -n \"$`echo ${cur%=}`\" |
@@ -62,13 +62,13 @@ _function()
 
 	if [[ $1 == @(declare|typeset) ]]; then
 		if [ "$prev" = -f ]; then
-			COMPREPLY=( $( compgen -A function -- $cur ) )
+			COMPREPLY=( $( compgen -A function -- "$cur" ) )
 		elif [[ "$cur" == -* ]]; then
 			COMPREPLY=( $( compgen -W '-a -f -F -i -r -x -p' -- \
-				       $cur ) )
+				       "$cur" ) )
 		fi
 	elif [ $COMP_CWORD -eq 1 ]; then
-		COMPREPLY=( $( compgen -A function -- $cur ) )
+		COMPREPLY=( $( compgen -A function -- "$cur" ) )
 	else
 		COMPREPLY=( "() $( type -- ${COMP_WORDS[1]} | sed -e 1,2d )" )
 	fi
@@ -90,7 +90,7 @@ _complete()
 			options="default dirnames filenames"
 			[ -n "$bash205b" ] && options="$options nospace"
 			[ -n "$bash3" ] && options="$options bashdefault plusdirs"
-			COMPREPLY=( $( compgen -W "$options" -- $cur ) )
+			COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
 			return 0
 			;;
 
@@ -99,21 +99,21 @@ _complete()
 				builtin command directory disabled enabled \
 				export file function group helptopic hostname \
 				job keyword running service setopt shopt \
-				signal stopped user variable' -- $cur ) )
+				signal stopped user variable' -- "$cur" ) )
 			return 0
 			;;
 
 		-C)
-			COMPREPLY=( $( compgen -A command -- $cur ) )
+			COMPREPLY=( $( compgen -A command -- "$cur" ) )
 			return 0
 			;;
 		-F)
-			COMPREPLY=( $( compgen -A function -- $cur ) )
+			COMPREPLY=( $( compgen -A function -- "$cur" ) )
 			return 0
 			;;
 		-@(p|r))
 			COMPREPLY=( $( complete -p | sed -e 's|.* ||' ) )
-			COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- $cur ) )
+			COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
 			return 0
 			;;
 
@@ -123,9 +123,9 @@ _complete()
 		# relevant options completion
 		options="-a -b -c -d -e -f -g -j -k -s -v -u -A -G -W -P -S -X -F -C"
 		[ -n "$bash205" ] && options="$options -o"
-		COMPREPLY=( $( compgen -W "$options" -- $cur ) )
+		COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
 	else
-		COMPREPLY=( $( compgen -A command -- $cur ) )
+		COMPREPLY=( $( compgen -A command -- "$cur" ) )
 	fi
 }
 complete -F _complete complete
diff --git a/contrib/bind-utils b/contrib/bind-utils
index 6cc5b06..30874a6 100644
--- a/contrib/bind-utils
+++ b/contrib/bind-utils
@@ -14,6 +14,6 @@ _nslookup()
 	COMPREPLY=( $( compgen -P '-' -W 'all class= debug d2 domain= \
 			       srchlist= defname search port= querytype= \
 			       type= recurse retry root timeout vc \
-			       ignoretc' -- $cur ) )
+			       ignoretc' -- "$cur" ) )
 } &&
 complete -F _nslookup nslookup
diff --git a/contrib/bittorrent b/contrib/bittorrent
index 9e49ac7..bc57f93 100644
--- a/contrib/bittorrent
+++ b/contrib/bittorrent
@@ -32,7 +32,7 @@ _btdownload()
 				--max_allow_in --check_hashes \
 				--max_upload_rate --snub_time --spew \
 				--rarest_first_cutoff --min_uploads \
-				--report_hash_failures' -- $cur ) )
+				--report_hash_failures' -- "$cur" ) )
 	else
 		_filedir
 	fi
diff --git a/contrib/bluez-utils b/contrib/bluez-utils
index 5586775..3b665da 100644
--- a/contrib/bluez-utils
+++ b/contrib/bluez-utils
@@ -8,27 +8,27 @@ _bluetooth_adresses()
 {
 	if [ -n "${COMP_BLUETOOTH_SCAN:-}" ]; then
 		COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "$( hcitool scan | \
-			awk '/^\t/{print $1}' )" -- $cur ) )
+			awk '/^\t/{print $1}' )" -- "$cur" ) )
 	fi
 }
 
 _bluetooth_devices()
 {
 	COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "$( hcitool dev | \
-		awk '/^\t/{print $1}' )" -- $cur ) )
+		awk '/^\t/{print $1}' )" -- "$cur" ) )
 }
 
 _bluetooth_services()
 {
 	COMPREPLY=( $( compgen -W 'DID SP DUN LAN FAX OPUSH FTP HS HF HFAG \
 		SAP NAP GN PANU HCRP HID CIP A2SRC A2SNK AVRCT AVRTG UDIUE \
-		UDITE SYNCML' -- $cur ) )
+		UDITE SYNCML' -- "$cur" ) )
 }
 
 _bluetooth_packet_types()
 {
 	COMPREPLY=( $( compgen -W 'DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3' -- \
-		$cur ) )
+		"$cur" ) )
 }
 
 _get_command()
@@ -60,7 +60,7 @@ _hcitool()
 			return 0;
 			;;
 		--role)
-			COMPREPLY=( $( compgen -W 'm s' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'm s' -- "$cur" ) )
 			return 0;
 			;;
 		--pkt-type)
@@ -74,11 +74,11 @@ _hcitool()
 	_get_command
 	if [ -z $command ]; then
 		if [[ "$cur" == -* ]]; then
-			COMPREPLY=( $( compgen -W '-h -i' -- $cur ) )
+			COMPREPLY=( $( compgen -W '-h -i' -- "$cur" ) )
 		else
 			COMPREPLY=( $( compgen -W 'dev inq scan name info \
 				spinq epinq cmd con cc dc sr cpt rssi lq tpl \
-				afh lst auth enc key clkoff clock' -- $cur ) )
+				afh lst auth enc key clkoff clock' -- "$cur" ) )
 		fi
 	else
 		case $command in
@@ -91,7 +91,7 @@ _hcitool()
 			cc)
 				if [[ "$cur" == -* ]]; then
 					COMPREPLY=( $( compgen -W '--role \
-						--pkt-type' -- $cur ) )
+						--pkt-type' -- "$cur" ) )
 				else
 					_count_args
 					if [ $args -eq 2 ]; then
@@ -105,7 +105,7 @@ _hcitool()
 					_bluetooth_adresses
 				else
 					COMPREPLY=( $( compgen -W \
-						'master slave' -- $cur ) )
+						'master slave' -- "$cur" ) )
 				fi
 				;;
 			cpt)
@@ -122,7 +122,7 @@ _hcitool()
 					_bluetooth_adresses
 				else
 					COMPREPLY=( $( compgen -W \
-						'0 1' -- $cur ) )
+						'0 1' -- "$cur" ) )
 				fi
 				;;
 		esac
@@ -152,17 +152,17 @@ _sdptool()
 	_get_command
 	if [ -z $command ]; then
 		if [[ "$cur" == -* ]]; then
-			COMPREPLY=( $( compgen -W '--help' -- $cur ) )
+			COMPREPLY=( $( compgen -W '--help' -- "$cur" ) )
 		else
 			COMPREPLY=( $( compgen -W 'search browse records add \
-				del get setattr setseq' -- $cur ) )
+				del get setattr setseq' -- "$cur" ) )
 		fi
 	else
 		case $command in
 			search)
 				if [[ "$cur" == -* ]]; then
 					COMPREPLY=( $( compgen -W '--bdaddr \
-						--tree --raw --xml' -- $cur ) )
+						--tree --raw --xml' -- "$cur" ) )
 				else
 					_bluetooth_services
 				fi
@@ -170,7 +170,7 @@ _sdptool()
 			@(browse|records))
 				if [[ "$cur" == -* ]]; then
 					COMPREPLY=( $( compgen -W '--tree \
-						--raw --xml' -- $cur ) )
+						--raw --xml' -- "$cur" ) )
 				else
 					_bluetooth_adresses
 				fi
@@ -178,7 +178,7 @@ _sdptool()
 			add)
 				if [[ "$cur" == -* ]]; then
 					COMPREPLY=( $( compgen -W '--handle \
-						--channel' -- $cur ) )
+						--channel' -- "$cur" ) )
 				else
 					_bluetooth_services
 				fi
@@ -186,7 +186,7 @@ _sdptool()
 			get)
 				if [[ "$cur" == -* ]]; then
 					COMPREPLY=( $( compgen -W '--bdaddr \
-						--tree --raw --xml' -- $cur ) )
+						--tree --raw --xml' -- "$cur" ) )
 				fi
 				;;
 		esac
@@ -210,7 +210,7 @@ _l2ping()
 	esac
 
 	if [[ "$cur" == -* ]]; then
-		COMPREPLY=( $( compgen -W '-i -s -c -t -f -r' -- $cur ) )
+		COMPREPLY=( $( compgen -W '-i -s -c -t -f -r' -- "$cur" ) )
 	else
 		_bluetooth_adresses
 	fi
@@ -243,10 +243,10 @@ _rfcomm()
 		if [[ "$cur" == -* ]]; then
 			COMPREPLY=( $( compgen -W '-h --help -a -r --raw -f \
 				--config -i -A --auth -E --encrypt -S --secure \
-				-M --master' -- $cur ) )
+				-M --master' -- "$cur" ) )
 		else
 			COMPREPLY=( $( compgen -W 'show connect listen watch \
-				bind release' -- $cur ) )
+				bind release' -- "$cur" ) )
 		fi
 	else
 		_count_args
@@ -284,10 +284,10 @@ _ciptool()
 	_get_command
 	if [ -z $command ]; then
 		if [[ "$cur" == -* ]]; then
-			COMPREPLY=( $( compgen -W '-h --help -i' -- $cur ) )
+			COMPREPLY=( $( compgen -W '-h --help -i' -- "$cur" ) )
 		else
 			COMPREPLY=( $( compgen -W 'show search connect release \
-				loopback' -- $cur ) )
+				loopback' -- "$cur" ) )
 		fi
 	else
 		case $command in
@@ -318,13 +318,13 @@ _dfutool()
 	esac
 
 	if [[ "$cur" == -* ]]; then
-		COMPREPLY=( $( compgen -W '-h --help -d --device' -- $cur ) )
+		COMPREPLY=( $( compgen -W '-h --help -d --device' -- "$cur" ) )
 	else
 		_count_args
 		case $args in
 			1)
 				COMPREPLY=( $( compgen -W 'verify modify \
-					upgrade archive' -- $cur ) )
+					upgrade archive' -- "$cur" ) )
 				;;
 			2)
 				_filedir
@@ -344,7 +344,7 @@ _hciconfig()
 	_get_command
 	if [ -z $command ]; then
 		if [[ "$cur" == -* ]]; then
-			COMPREPLY=( $( compgen -W '-h --help -a --all' -- $cur ) )
+			COMPREPLY=( $( compgen -W '-h --help -a --all' -- "$cur" ) )
 		else
 			COMPREPLY=( $( compgen -W 'up down reset rstat auth \
 				noauth encrypt noencrypt secmgr nosecmgr \
@@ -352,7 +352,7 @@ _hciconfig()
 				voice iac inqmode inqdata inqtype inqparams \
 				pageparms pageto afhmode aclmtu scomtu putkey \
 				delkey commands features version revision lm' \
-				-- $cur ) )
+				-- "$cur" ) )
 		fi
 	else
 		case $command in
@@ -366,7 +366,7 @@ _hciconfig()
 				_count_args
 				if [ $args -eq 2 ]; then
 					COMPREPLY=( $( compgen -W 'MASTER \
-						SLAVE NONE ACCEPT' -- $cur ) )
+						SLAVE NONE ACCEPT' -- "$cur" ) )
 				fi
 				;;
 			ptype)
@@ -388,28 +388,28 @@ _hciattach()
 	cur=`_get_cword`
 
 	if [[ "$cur" == -* ]]; then
-		COMPREPLY=( $( compgen -W '-n -p -t -b -s -l' -- $cur ) )
+		COMPREPLY=( $( compgen -W '-n -p -t -b -s -l' -- "$cur" ) )
 	else
 		_count_args
 		case $args in
 			1)
 				COMPREPLY=( $( command ls /dev/tty* ) )
 				COMPREPLY=( $( compgen -W '${COMPREPLY[@]} \
-					${COMPREPLY[@]#/dev/}' -- $cur ) )
+					${COMPREPLY[@]#/dev/}' -- "$cur" ) )
 				;;
 			2)
 				COMPREPLY=( $( compgen -W 'any ericsson digi \
 					xircom csr bboxes swave bcsp 0x0105 \
-					0x080a 0x0160 0x0002' -- $cur ) )
+					0x080a 0x0160 0x0002' -- "$cur" ) )
 				;;
 			3)
 				COMPREPLY=( $( compgen -W '9600 19200 38400 \
 					57600 115200 230400 460800 921600' \
-					-- $cur ) )
+					-- "$cur" ) )
 				;;
 			4)
 				COMPREPLY=( $( compgen -W 'flow noflow' \
-					-- $cur ) )
+					-- "$cur" ) )
 				;;
 			5)
 				_bluetooth_adresses
@@ -429,7 +429,7 @@ _hid2hci()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-h --help -q --quiet -0 --tohci -1 \
-			--tohid' -- $cur ) )
+			--tohid' -- "$cur" ) )
 	fi
 }
 complete -F _hid2hci hid2hci
@@ -442,11 +442,11 @@ _avctrl()
 	cur=`_get_cword`
 
 	if [[ "$cur" == -* ]]; then
-		COMPREPLY=( $( compgen -W '-h --help -q --quiet' -- $cur ) )
+		COMPREPLY=( $( compgen -W '-h --help -q --quiet' -- "$cur" ) )
 	else
 		_count_args
 		if [ $args -eq 1 ]; then
-			COMPREPLY=( $( compgen -W 'discover switch' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'discover switch' -- "$cur" ) )
 		fi
 	fi
 }
diff --git a/contrib/brctl b/contrib/brctl
index 1ecdc12..2d359bb 100644
--- a/contrib/brctl
+++ b/contrib/brctl
@@ -17,7 +17,7 @@ _brctl()
 			COMPREPLY=( $( compgen -W "addbr delbr addif delif \
 				setageing setbridgeprio setfd sethello \
 				setmaxage setpathcost setportprio show \
-				showmacs showstp stp" -- $cur ) )
+				showmacs showstp stp" -- "$cur" ) )
 			;;
 		2)
 			case $command in
@@ -26,7 +26,7 @@ _brctl()
 				*)
 					COMPREPLY=( $( compgen -W "$(brctl \
 						show | sed '1d' | \
-						awk '{print $1}' )" -- $cur ) )
+						awk '{print $1}' )" -- "$cur" ) )
 			esac
 			;;
 		3)
@@ -35,7 +35,7 @@ _brctl()
 					_configured_interfaces
 					;;
 				stp)
-					COMPREPLY=( $( compgen -W 'on off' -- $cur ) )
+					COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
 					;;
 			esac
 			;;
diff --git a/contrib/bzip2 b/contrib/bzip2
index 0e36269..d0017b3 100644
--- a/contrib/bzip2
+++ b/contrib/bzip2
@@ -17,7 +17,7 @@ _bzip2()
 			-t -v -V -z -1 -2 -3 -4 -5 -6 -7 -8 -9 \
 			--help --decompress --compress --keep --force \
 			--test --stdout --quiet --verbose --license \
-			--version --small --fast --best' -- $cur ) )
+			--version --small --fast --best' -- "$cur" ) )
 		return 0
 	fi
 
@@ -36,7 +36,7 @@ _bzip2()
 
 	_expand || return 0
 
-	COMPREPLY=( $( compgen -f -X "$xspec" -- $cur ) \
-		    $( compgen -d -- $cur ) )
+	COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
+		    $( compgen -d -- "$cur" ) )
 } &&
 complete -F _bzip2 $filenames bzip2
diff --git a/contrib/cardctl b/contrib/cardctl
index c7753b0..689088d 100644
--- a/contrib/cardctl
+++ b/contrib/cardctl
@@ -14,7 +14,7 @@ _cardctl()
 	if [ $COMP_CWORD -eq 1 ]; then
 		COMPREPLY=( $( compgen -W 'status config ident suspend \
 					   resume reset eject insert scheme' \
-			       -- $cur ) )
+			       -- "$cur" ) )
 	fi
 } &&
 complete -F _cardctl cardctl
diff --git a/contrib/cfengine b/contrib/cfengine
index d07844c..7b859ed 100644
--- a/contrib/cfengine
+++ b/contrib/cfengine
@@ -15,7 +15,7 @@ _cfagent_options()
 		-N --negate --undefine -p --parse-only -P --no-processes -q \
 		--no-splay -s --no-commands -S --silent -t --no-tidy -u \
 		--use-env -U --underscore-classes -v --verbose -V --version \
-		-x --no-preconf -X --no-links -w --no-warn --quiet' -- $cur ) )
+		-x --no-preconf -X --no-links -w --no-warn --quiet' -- "$cur" ) )
 }
 
 _cfagent()
@@ -77,7 +77,7 @@ _cfrun()
 				[ ! -f $hostfile ] && return 0
 
 				COMPREPLY=( $(compgen -W  "$( grep -v \
-					-E '(=|^$|^#)' $hostfile )" -- $cur ) )
+					-E '(=|^$|^#)' $hostfile )" -- "$cur" ) )
 			fi
 			;;
 		2)
diff --git a/contrib/chkconfig b/contrib/chkconfig
index 87488cb..bb4711b 100644
--- a/contrib/chkconfig
+++ b/contrib/chkconfig
@@ -20,7 +20,7 @@ _chkconfig()
 		return 0
 		;;
 	--level)
-		COMPREPLY=( $( compgen -W '1 2 3 4 5 6' -- $cur ) )
+		COMPREPLY=( $( compgen -W '1 2 3 4 5 6' -- "$cur" ) )
 		return 0
 		;;
 	esac
@@ -29,11 +29,11 @@ _chkconfig()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '--list --add --del --override \
-						--level' -- $cur ) )
+						--level' -- "$cur" ) )
 	else
 		if [ $COMP_CWORD -eq 2 -o $COMP_CWORD -eq 4 ]; then
 			COMPREPLY=( $( compgen -W 'on off reset \
-						resetpriorities' -- $cur ) )
+						resetpriorities' -- "$cur" ) )
 		else
 			_services
 		fi
diff --git a/contrib/chsh b/contrib/chsh
index 47c4d14..b1c0eb8 100644
--- a/contrib/chsh
+++ b/contrib/chsh
@@ -14,7 +14,7 @@ _chsh()
 	if [ "$prev" = "-s" ]; then
 		_shells
 	else
-		COMPREPLY=( $( compgen -u -- $cur ) )
+		COMPREPLY=( $( compgen -u -- "$cur" ) )
 	fi
 
 	return 0
diff --git a/contrib/cksfv b/contrib/cksfv
index b875870..2b1d55f 100644
--- a/contrib/cksfv
+++ b/contrib/cksfv
@@ -10,7 +10,7 @@ _cksfv()
 	cur=`_get_cword`
 
 	if [ $COMP_CWORD -eq 1 ]; then
-		COMPREPLY=( $( compgen -W '-C -f -i -q -v' -- $cur ) )
+		COMPREPLY=( $( compgen -W '-C -f -i -q -v' -- "$cur" ) )
 		return 0
 	fi
 
diff --git a/contrib/clisp b/contrib/clisp
index bc4e376..9ea40f4 100644
--- a/contrib/clisp
+++ b/contrib/clisp
@@ -17,7 +17,7 @@ _clisp()
 	COMPREPLY=( $( compgen -W '-h --help --version --license -B -K \
                      -M -m -L -N -E -q --quiet --silent -w -I -ansi \
                      -traditional -p -C -norc -i -c -l -o -x ' \
-                     -- $cur ) )
+                     -- "$cur" ) )
     else
 	_filedir
     fi
diff --git a/contrib/cowsay b/contrib/cowsay
index 31682c6..b63eadf 100644
--- a/contrib/cowsay
+++ b/contrib/cowsay
@@ -15,13 +15,13 @@ _cowsay()
 	case $prev in
 		-f)
 			COMPREPLY=( $( compgen -W '$( cowsay -l | tail -n +2 \
-				)' -- $cur ) )
+				)' -- "$cur" ) )
 			return 0
 			;;
 	esac
 
 	# relevant options completion
-	COMPREPLY=( $( compgen -W '-b -d -g -p -s -t -w -y -e -f -h -l -n -T -W' -- $cur ) )
+	COMPREPLY=( $( compgen -W '-b -d -g -p -s -t -w -y -e -f -h -l -n -T -W' -- "$cur" ) )
 
 } &&
 complete -F _cowsay $default cowsay cowthink
diff --git a/contrib/cpio b/contrib/cpio
index 9bab21b..67c0ea3 100644
--- a/contrib/cpio
+++ b/contrib/cpio
@@ -6,7 +6,7 @@
 have cpio && {
 _cpio_format()
 {
-	COMPREPLY=( $( compgen -W 'bin odc newc crc tar ustar hpbin hpodc' -- $cur ) )
+	COMPREPLY=( $( compgen -W 'bin odc newc crc tar ustar hpbin hpodc' -- "$cur" ) )
 }
 
 _cpio()
@@ -34,7 +34,7 @@ _cpio()
 			return 0
 			;;
 		--rsh-command)
-			COMPREPLY=( $( compgen -c -- $cur ) )
+			COMPREPLY=( $( compgen -c -- "$cur" ) )
 			return 0
 			;;
 	esac
@@ -42,7 +42,7 @@ _cpio()
 	$split && return 0
 
 	if [ $COMP_CWORD -eq 1 ]; then
-		COMPREPLY=( $( compgen -W '-o --create -i --extract -p --pass-through' -- $cur) )
+		COMPREPLY=( $( compgen -W '-o --create -i --extract -p --pass-through' -- "$cur" ) )
 	else
 		case ${COMP_WORDS[1]} in
 			-@(o|-create))
@@ -53,7 +53,7 @@ _cpio()
 						--verbose --dot --append --block-size\
 						--dereference --io-size --quiet\
 						--force-local --rsh-command --help\
-						--version' -- $cur ) )
+						--version' -- "$cur" ) )
 				fi
 				;;
 			-@(i|-extract))
@@ -72,7 +72,7 @@ _cpio()
 						--force-local --no-absolute-filenames\
 						--sparse --only-verify-crc --quiet\
 						--rsh-command --help\
-						--version' -- $cur ) )
+						--version' -- "$cur" ) )
 				fi
 				;;
 			-@(p|-pass-through))
@@ -84,7 +84,7 @@ _cpio()
 						--unconditional --verbose --dot\
 						--dereference --owner\
 						--no-preserve-owner --sparse --help\
-						--version' -- $cur ) )
+						--version' -- "$cur" ) )
 				else
 					_filedir -d
 				fi
diff --git a/contrib/cups b/contrib/cups
index 9e0dbf1..619a602 100644
--- a/contrib/cups
+++ b/contrib/cups
@@ -11,6 +11,6 @@ _cancel()
 	COMPREPLY=()
 	cur=`_get_cword`
 
-	COMPREPLY=( $( compgen -W "$( lpstat | cut -d' ' -f1 )" -- $cur ) )
+	COMPREPLY=( $( compgen -W "$( lpstat | cut -d' ' -f1 )" -- "$cur" ) )
 } &&
 complete -F _cancel $filenames cancel
diff --git a/contrib/cvs b/contrib/cvs
index cd6c0e7..98b070b 100644
--- a/contrib/cvs
+++ b/contrib/cvs
@@ -126,7 +126,7 @@ _cvs()
 					       $cur ) )
 			fi
 		else
-			COMPREPLY=( $( compgen -W '-k -m' -- $cur ) )
+			COMPREPLY=( $( compgen -W '-k -m' -- "$cur" ) )
 		fi
 		;;
 	admin)
@@ -139,10 +139,10 @@ _cvs()
 		;;
 	annotate)
 		if [[ "$cur" = -* ]]; then
-			COMPREPLY=( $( compgen -W '-D -F -f -l -R -r' -- $cur ) )
+			COMPREPLY=( $( compgen -W '-D -F -f -l -R -r' -- "$cur" ) )
 		else
 			get_entries
-			COMPREPLY=( $( compgen -W '${entries[@]}' -- $cur ) )
+			COMPREPLY=( $( compgen -W '${entries[@]}' -- "$cur" ) )
 		fi
 		;;
 	checkout)
@@ -150,10 +150,10 @@ _cvs()
 			[ -z "$cvsroot" ] && cvsroot=$CVSROOT
 			COMPREPLY=( $( cvs -d "$cvsroot" co -c 2> /dev/null | \
 					awk '{print $1}' ) )
-			COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- $cur ) )
+			COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
 		else
 			COMPREPLY=( $( compgen -W '-A -N -P -R -c -f -l -n -p \
-						  -s -r -D -d -k -j' -- $cur ) )
+						  -s -r -D -d -k -j' -- "$cur" ) )
 		fi
 		;;
 	commit)
@@ -173,7 +173,7 @@ _cvs()
 				newremoved=( $( cvs -q diff --brief 2>&1 | \
 				sed -ne 's/^cvs diff: \([^ ]*\) .*, no comparison available$/\1/p' ) )
 				COMPREPLY=( $( compgen -W '${changed[@]:-} \
-						   ${newremoved[@]:-}' -- $cur ) )
+						   ${newremoved[@]:-}' -- "$cur" ) )
 			else
 				COMPREPLY=( $(compgen $default -- "$cur") )
 			fi
@@ -186,17 +186,17 @@ _cvs()
 		if [ -r ~/.cvspass ]; then
 			# Ugly escaping because of bash treating ':' specially
 			cvsroots=$( sed 's/^[^ ]* //; s/:/\\:/g' ~/.cvspass )
-			COMPREPLY=( $( compgen -W '$cvsroots' -- $cur ) )
+			COMPREPLY=( $( compgen -W '$cvsroots' -- "$cur" ) )
 		fi
 		;;
 	export)
 		if [[ "$cur" != -* ]]; then
 			[ -z "$cvsroot" ] && cvsroot=$CVSROOT
 			COMPREPLY=( $( cvs -d "$cvsroot" co -c | awk '{print $1}' ) )
-			COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- $cur ) )
+			COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
 		else
 			COMPREPLY=( $( compgen -W '-N -f -l -R -n \
-						  -r -D -d -k' -- $cur ) )
+						  -r -D -d -k' -- "$cur" ) )
 		fi
 		;;
 	diff)
@@ -204,7 +204,7 @@ _cvs()
 			_longopt diff
 		else
 			get_entries
-			COMPREPLY=( $( compgen -W '${entries[@]:-}' -- $cur ) )
+			COMPREPLY=( $( compgen -W '${entries[@]:-}' -- "$cur" ) )
 		fi
 		;;
 	remove)
@@ -216,10 +216,10 @@ _cvs()
 				for i in "${entries[@]}"; do
 					[ ! -r "$i" ] && miss=( "${miss[@]}" $i )
 				done
-				COMPREPLY=( $(compgen -W '${miss[@]:-}' -- $cur) )
+				COMPREPLY=( $(compgen -W '${miss[@]:-}' -- "$cur") )
 			fi
 		else
-			COMPREPLY=( $( compgen -W '-f -l -R' -- $cur ) )
+			COMPREPLY=( $( compgen -W '-f -l -R' -- "$cur" ) )
 		fi
 		;;
 	import)
@@ -237,14 +237,14 @@ _cvs()
 			COMPREPLY=( $( compgen -W '${COMPREPLY[@]} $pwd' -- \
 				       $cur ) )
 		else
-			COMPREPLY=( $( compgen -W '-d -k -I -b -m -W' -- $cur ))
+			COMPREPLY=( $( compgen -W '-d -k -I -b -m -W' -- "$cur" ))
 		fi
 		;;
 	update)
 		if [[ "$cur" = -* ]]; then
 			COMPREPLY=( $( compgen -W '-A -P -C -d -f -l -R -p \
 						   -k -r -D -j -I -W' -- \
-						   $cur ) )
+						   "$cur" ) )
 		fi
 		;;
 	"")
@@ -255,7 +255,7 @@ _cvs()
 					   rfreeze rlog rm rtag stat status \
 					   tag unedit up update -H -Q -q -b \
 					   -d -e -f -l -n -t -r -v -w -x -z \
-					   --help --version' -- $cur ) )
+					   --help --version' -- "$cur" ) )
 		;;
 	*)
 		;;
diff --git a/contrib/dcop b/contrib/dcop
index 85a67ab..a3e568f 100644
--- a/contrib/dcop
+++ b/contrib/dcop
@@ -15,6 +15,6 @@ _dcop()
 	else
 	    compstr=$( command echo ${COMP_WORDS[*]} | sed "s/ $cur$//" )
 	fi
-	COMPREPLY=( $( compgen -W '$( command $compstr | sed s/\(.*\)// )'  -- $cur ) )
+	COMPREPLY=( $( compgen -W '$( command $compstr | sed s/\(.*\)// )'  -- "$cur" ) )
 } &&
 complete -F _dcop dcop
diff --git a/contrib/dd b/contrib/dd
index 5bc16a3..9373457 100644
--- a/contrib/dd
+++ b/contrib/dd
@@ -21,15 +21,15 @@ _dd()
 		cur=${cur#*=}
 		COMPREPLY=( $( compgen -W 'ascii ebcdic ibm block unblock \
 				lcase notrunc ucase swab noerror sync' \
-				-- $cur ) )
+				-- "$cur" ) )
 		return 0
 		;;
 	esac
 
 	_expand || return 0
 
-	COMPREPLY=( $( compgen -W '--help --version' -- $cur ) \
+	COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) \
 				$( compgen -W 'bs cbs conv count ibs if obs of seek skip'\
-				-S '=' -- $cur ) )
+				-S '=' -- "$cur" ) )
 } &&
 complete -F _dd $nospace $filenames dd
diff --git a/contrib/dhclient b/contrib/dhclient
index 722dc69..a33a05b 100644
--- a/contrib/dhclient
+++ b/contrib/dhclient
@@ -24,7 +24,7 @@ have dhclient && _dhclient()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-p -d -q -1 -r -lf -pf \
-			-cf -sf -s -g -n -nw -w' -- $cur ) )
+			-cf -sf -s -g -n -nw -w' -- "$cur" ) )
 	else
 		_available_interfaces
 	fi
diff --git a/contrib/dpkg b/contrib/dpkg
index 45890aa..6bca9e2 100644
--- a/contrib/dpkg
+++ b/contrib/dpkg
@@ -52,7 +52,7 @@ _dpkg()
 		return 0
 		;;
    	-@(s|p|l|-@(status|print-avail|list)))
-		COMPREPLY=( $( apt-cache pkgnames $cur 2>/dev/null ) )
+		COMPREPLY=( $( apt-cache pkgnames "$cur" 2>/dev/null ) )
 		return 0
 		;;
 	-@(S|-search))
@@ -60,7 +60,7 @@ _dpkg()
 		return 0
 		;;
 	-@(r|L|P|-@(remove|purge|listfiles)))
-		COMPREPLY=( $( _comp_dpkg_installed_packages $cur ) )
+		COMPREPLY=( $( _comp_dpkg_installed_packages "$cur" ) )
 		return 0
 		;;
 	*)
@@ -89,7 +89,7 @@ _dpkg()
 			--no-debsig --no-act -D --debug --status-fd \
 			-b --build -I --info -f --field -c --contents \
 			-x --extract -X --vextract --fsys-tarfile -e --control \
-			--ignore-depends --abort-after' -- $cur ) )
+			--ignore-depends --abort-after' -- "$cur" ) )
 		;;
 	esac
 
@@ -115,11 +115,11 @@ _dpkg_reconfigure()
 		opt=( $( echo /usr/share/perl5/Debconf/FrontEnd/* ) )
 		opt=( ${opt[@]##*/} )
 		opt=( ${opt[@]%.pm} )
-		COMPREPLY=( $( compgen -W '${opt[@]}' -- $cur ) )
+		COMPREPLY=( $( compgen -W '${opt[@]}' -- "$cur" ) )
 		return 0
 		;;
 	    -@(p|-priority))
-  		COMPREPLY=( $( compgen -W 'low medium high critical' -- $cur ) )
+  		COMPREPLY=( $( compgen -W 'low medium high critical' -- "$cur" ) )
 		return 0
 		;;
 	esac
@@ -127,9 +127,9 @@ _dpkg_reconfigure()
 	if [[ "$cur" == -* ]]; then
 	    COMPREPLY=( $( compgen -W '-f --frontend -p --priority -a --all \
 				       -u --unseen-only -h --help -s --showold \
-				       --force --terse' -- $cur ) )
+				       --force --terse' -- "$cur" ) )
 	else
-	    COMPREPLY=( $( _comp_dpkg_installed_packages $cur ) )
+	    COMPREPLY=( $( _comp_dpkg_installed_packages "$cur" ) )
 	fi
 } &&
 complete -F _dpkg_reconfigure $default dpkg-reconfigure
diff --git a/contrib/dselect b/contrib/dselect
index 770438d..13f89f7 100644
--- a/contrib/dselect
+++ b/contrib/dselect
@@ -26,10 +26,10 @@ _dselect()
 
 	if [[ "$cur" == -* ]]; then
 	    COMPREPLY=( $( compgen -W '--admindir --help --version --licence \
-				  --license --expert --debug' -- $cur ) )
+				  --license --expert --debug' -- "$cur" ) )
 	else
 	    COMPREPLY=( $( compgen -W 'access update select install config \
-				  remove quit' -- $cur ) )
+				  remove quit' -- "$cur" ) )
 	fi
 
 
diff --git a/contrib/dsniff b/contrib/dsniff
index db3c972..30649db 100644
--- a/contrib/dsniff
+++ b/contrib/dsniff
@@ -26,7 +26,7 @@ _arpspoof()
 	esac
 
 	if [[ "$cur" == -* ]]; then
-		COMPREPLY=( $( compgen -W '-i -t' -- $cur ) )
+		COMPREPLY=( $( compgen -W '-i -t' -- "$cur" ) )
 	else
 		_known_hosts_real "$cur"
 	fi
@@ -57,7 +57,7 @@ _dnsspoof()
 	esac
 
 	if [[ "$cur" == -* ]]; then
-		COMPREPLY=( $( compgen -W '-i -f' -- $cur ) )
+		COMPREPLY=( $( compgen -W '-i -f' -- "$cur" ) )
 	fi
 
 } &&
@@ -87,7 +87,7 @@ _dsniff()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-c -d -m -n -i -s -f -t \
-			-r -w' -- $cur ) )
+			-r -w' -- "$cur" ) )
 	fi
 
 } &&
@@ -112,7 +112,7 @@ _snarf()
 	esac
 
 	if [[ "$cur" == -* ]]; then
-		COMPREPLY=( $( compgen -W '-i -v' -- $cur ) )
+		COMPREPLY=( $( compgen -W '-i -v' -- "$cur" ) )
 	fi
 
 } &&
@@ -138,7 +138,7 @@ _macof()
 
 
 	if [[ "$cur" == -* ]]; then
-		COMPREPLY=( $( compgen -W '-i -s -d -e -x -y -n' -- $cur ) )
+		COMPREPLY=( $( compgen -W '-i -s -d -e -x -y -n' -- "$cur" ) )
 	fi
 
 } &&
@@ -155,7 +155,7 @@ _sshmitm()
 	cur=`_get_cword`
 
 	if [[ "$cur" == -* ]]; then
-		COMPREPLY=( $( compgen -W '-d -I -p' -- $cur ) )
+		COMPREPLY=( $( compgen -W '-d -I -p' -- "$cur" ) )
 	else
 		_known_hosts_real "$cur"
 	fi
@@ -182,7 +182,7 @@ _sshow()
 	esac
 
 	if [[ "$cur" == -* ]]; then
-		COMPREPLY=( $( compgen -W '-d -i' -- $cur ) )
+		COMPREPLY=( $( compgen -W '-d -i' -- "$cur" ) )
 	fi
 
 } &&
@@ -207,7 +207,7 @@ _tcpkill()
 	esac
 
 	if [[ "$cur" == -* ]]; then
-		COMPREPLY=( $( compgen -W '-i -1 -2 -3 -4 -5 -6 -7 -8 -9' -- $cur ) )
+		COMPREPLY=( $( compgen -W '-i -1 -2 -3 -4 -5 -6 -7 -8 -9' -- "$cur" ) )
 	fi
 
 } &&
@@ -232,7 +232,7 @@ _tcpnice()
 	esac
 
 	if [[ "$cur" == -* ]]; then
-		COMPREPLY=( $( compgen -W '-A -I -M -i' -- $cur ) )
+		COMPREPLY=( $( compgen -W '-A -I -M -i' -- "$cur" ) )
 	fi
 
 } &&
@@ -257,7 +257,7 @@ _urlsnarf()
 	esac
 
 	if [[ "$cur" == -* ]]; then
-		COMPREPLY=( $( compgen -W '-n -i -v' -- $cur ) )
+		COMPREPLY=( $( compgen -W '-n -i -v' -- "$cur" ) )
 	fi
 
 } &&
@@ -274,7 +274,7 @@ _webmitm()
 	cur=`_get_cword`
 
 	if [[ "$cur" == -* ]]; then
-		COMPREPLY=( $( compgen -W '-d' -- $cur ) )
+		COMPREPLY=( $( compgen -W '-d' -- "$cur" ) )
 	else
 		_known_hosts_real "$cur"
 	fi
diff --git a/contrib/findutils b/contrib/findutils
index 6cc3887..09c0aa3 100644
--- a/contrib/findutils
+++ b/contrib/findutils
@@ -16,7 +16,7 @@ _find()
 
 	case "$prev" in
 	-@(max|min)depth)
-		COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9' -- $cur ) )
+		COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9' -- "$cur" ) )
 		return 0
 		;;
 	-?(a|c)newer|-fls|-fprint?(0|f)|-?(i)?(l)name|-?(i)wholename)
@@ -26,7 +26,7 @@ _find()
 	-fstype)
 		# this is highly non-portable
 		[ -e /proc/filesystems ] &&
-		COMPREPLY=( $( compgen -W "$( cut -d$'\t' -f2 /proc/filesystems )" -- $cur ) )
+		COMPREPLY=( $( compgen -W "$( cut -d$'\t' -f2 /proc/filesystems )" -- "$cur" ) )
 		return 0
 		;;
 	-gid)
@@ -40,7 +40,7 @@ _find()
 		return 0
 		;;
 	-?(x)type)
-		COMPREPLY=( $( compgen -W 'b c d p f l s' -- $cur ) )
+		COMPREPLY=( $( compgen -W 'b c d p f l s' -- "$cur" ) )
 		return 0
 		;;
 	-uid)
@@ -48,11 +48,11 @@ _find()
 		return 0
 		;;
 	-user)
-		COMPREPLY=( $( compgen -u -- $cur ) )
+		COMPREPLY=( $( compgen -u -- "$cur" ) )
 		return 0
 		;;
 	-exec|-ok)
-		COMP_WORDS=(COMP_WORDS[0] $cur)
+		COMP_WORDS=(COMP_WORDS[0] "$cur")
 		COMP_CWORD=1
 		_command
 		return 0
@@ -86,7 +86,7 @@ _find()
 			-links -lname -mmin -mtime -name -newer -nouser \
 			-nogroup -perm -regex -size -true -type -uid -used \
 			-user -xtype -exec -fls -fprint -fprint0 -fprintf -ok \
-			-print -print0 -printf -prune -ls -wholename -iwholename' -- $cur ) )
+			-print -print0 -printf -prune -ls -wholename -iwholename' -- "$cur" ) )
 
 	# this removes any options from the list of completions that have
 	# already been specified somewhere on the command line, as long as
diff --git a/contrib/freeciv b/contrib/freeciv
index 6a68dca..3fe4b58 100644
--- a/contrib/freeciv
+++ b/contrib/freeciv
@@ -23,7 +23,7 @@ _civserver()
 		COMPREPLY=( $( compgen -W '-d -f -g -h -i -l -m -M -p -q -r -v\
 			--debug --file --gamelog --help --info --log --meta \
 			--Metaserver --port --quitidle --read --version' \
-			-- $cur ) )
+			-- "$cur" ) )
 	fi
 
 } &&
@@ -46,7 +46,7 @@ _civclient()
 			return 0
 			;;
 		-@(P|-Plugin))
-			COMPREPLY=( $( compgen -W 'none esd sdl' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'none esd sdl' -- "$cur" ) )
 			return 0
 			;;
 		-@(s|-server))
@@ -59,7 +59,7 @@ _civclient()
 		COMPREPLY=( $( compgen -W '-a -d -h -l -m -n -p -P -s -S -t -v\
 			--autoconnect --debug --help --log --meta --name \
 			--port --Plugin --server --Sound --tiles --version' \
-			-- $cur ) )
+			-- "$cur" ) )
 	fi
 
 } &&
diff --git a/contrib/gcc b/contrib/gcc
index baea2c1..889cf7d 100644
--- a/contrib/gcc
+++ b/contrib/gcc
@@ -44,7 +44,7 @@ _gcc()
 		COMPREPLY=( $( compgen -W "$( $cc --help 2>/dev/null | \
 			       tr '\t' ' ' | \
 			       sed -e '/^  *-/!d' -e 's/ *-\([^ ]*\).*/-\1/' | \
-			       sort -u )" -- $cur ) )
+			       sort -u )" -- "$cur" ) )
 	else
 		_filedir
 	fi
diff --git a/contrib/gcl b/contrib/gcl
index b06a287..16c4eba 100644
--- a/contrib/gcl
+++ b/contrib/gcl
@@ -16,7 +16,7 @@ _gcl()
     if [[ "$cur" == -* ]]; then
 	COMPREPLY=( $( compgen -W '-eval -load -f -batch -dir -libdir \
                      -compile -o-file -c-file -h-file -data-file -system-p '\
-                     -- $cur ) )
+                     -- "$cur" ) )
     else
 	_filedir
     fi
diff --git a/contrib/genisoimage b/contrib/genisoimage
index 4ca9221..9ee0606 100644
--- a/contrib/genisoimage
+++ b/contrib/genisoimage
@@ -19,7 +19,7 @@ _mkisofs()
 			;;
 		-*-charset)
 			COMPREPLY=( $( compgen -W '$( mkisofs -input-charset \
-					help 2>&1 | tail -n +3 )' -- $cur ) )
+					help 2>&1 | tail -n +3 )' -- "$cur" ) )
 			return 0
 			;;
 		-uid)
@@ -65,7 +65,7 @@ _mkisofs()
 				-hfs-unlock -hfs-bless -hfs-parms --cap \
 				--netatalk --double --ethershare --ushare \
 				--exchange --sgi --xinet --macbin --single \
-				--dave --sfm --osx-double --osx-hfs' -- $cur ))
+				--dave --sfm --osx-double --osx-hfs' -- "$cur" ))
 	else
 		_filedir
 	fi
diff --git a/contrib/getent b/contrib/getent
index a08bd19..1518ce4 100644
--- a/contrib/getent
+++ b/contrib/getent
@@ -14,29 +14,29 @@ _getent()
 
 	case $prev in
 		passwd)
-			COMPREPLY=( $( compgen -u $cur  ) )
+			COMPREPLY=( $( compgen -u "$cur"  ) )
 			return 0
 			;;
 		group)
-			COMPREPLY=( $( compgen -g $cur  ) )
+			COMPREPLY=( $( compgen -g "$cur"  ) )
 			return 0
 			;;
 		services)
-			COMPREPLY=( $( compgen -s $cur  ) )
+			COMPREPLY=( $( compgen -s "$cur"  ) )
 			return 0
 			;;
 		hosts)
-			COMPREPLY=( $( compgen -A hostname $cur  ) )
+			COMPREPLY=( $( compgen -A hostname "$cur"  ) )
 			return 0
 			;;
 		protocols|networks|ahosts|ahostsv4|ahostsv6|rpc)
-			COMPREPLY=( $( getent $prev | \
-				sed -ne 's|^\('$cur'[^[:space:]]*\).*|\1|p' ) )
+			COMPREPLY=( $( getent "$prev" | \
+				sed -ne 's|^\('"$cur"'[^[:space:]]*\).*|\1|p' ) )
 			return 0
 			;;
 		aliases|shadow)
-			COMPREPLY=( $( getent $prev | \
-				sed -ne 's|^\('$cur'[^:]*\).*|\1|p' ) )
+			COMPREPLY=( $( getent "$prev" | \
+				sed -ne 's|^\('"$cur"'[^:]*\).*|\1|p' ) )
 			return 0
 			;;
 	esac
@@ -46,7 +46,7 @@ _getent()
 		COMPREPLY=( $( compgen -W 'passwd group hosts services \
 					   protocols networks ahosts ahostsv4 \
 					   ahostsv6 aliases ethers netgroup \
-					   rpc shadow' -- $cur ) )
+					   rpc shadow' -- "$cur" ) )
 	fi
 } &&
 complete -F _getent getent
diff --git a/contrib/gkrellm b/contrib/gkrellm
index 38d4231..6eb3056 100644
--- a/contrib/gkrellm
+++ b/contrib/gkrellm
@@ -31,7 +31,7 @@ _gkrellm()
 		COMPREPLY=( $( compgen -W '--help -t --theme -s --server \
 			-g --geometry -wm -w --withdrawn -c --config -nc \
 			-f --force-host-config -demo -p --plugin -P \
-			--port' -- $cur ) )
+			--port' -- "$cur" ) )
 	fi
 
 } &&
diff --git a/contrib/gnatmake b/contrib/gnatmake
index 6b45212..2cfa6bb 100644
--- a/contrib/gnatmake
+++ b/contrib/gnatmake
@@ -23,7 +23,7 @@ _gnatmake()
                                -gnatO -gnatp -gnatP -gnatq -gnatR -gnats \
                                -gnatt -gnatT -gnatu -gnatU -gnatv -gnatws \
                                -gnatwe -gnatwl -gnatwu -gnatW -gnatx -gnatX \
-                               -gnaty -gnatz -gnatZ -gnat83' -- $cur ) )
+                               -gnaty -gnatz -gnatZ -gnat83' -- "$cur" ) )
 	else
 			# source file completion
 			_filedir '@(adb|ads)'
diff --git a/contrib/gpg b/contrib/gpg
index a308222..95e1dea 100644
--- a/contrib/gpg
+++ b/contrib/gpg
@@ -33,7 +33,7 @@ _gpg()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-s -b -e -f -c -d -a -r -u -Z -o -v\
-				-q -n -N $(gpg --dump-options)' -- $cur ) )
+				-q -n -N $(gpg --dump-options)' -- "$cur" ) )
 	 fi
 
 } &&
diff --git a/contrib/gpg2 b/contrib/gpg2
index e46fda9..61fa3f2 100644
--- a/contrib/gpg2
+++ b/contrib/gpg2
@@ -37,7 +37,7 @@ _gpg2 ()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-s -b -e -c -d -k -K -a -r -u -z -o -v \
-									-n -N -i -h -R -t $(gpg2 --dump-options)' -- $cur ) )
+									-n -N -i -h -R -t $(gpg2 --dump-options)' -- "$cur" ) )
 	fi
 } &&
 complete -F _gpg2 $default gpg2
diff --git a/contrib/gzip b/contrib/gzip
index 6d3b1a1..ada5de1 100644
--- a/contrib/gzip
+++ b/contrib/gzip
@@ -38,7 +38,7 @@ _gzip()
 
 	_expand || return 0
 
-	COMPREPLY=( $( compgen -f -X "$xspec" -- $cur ) \
-		    $( compgen -d -- $cur ) )
+	COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
+		    $( compgen -d -- "$cur" ) )
 } &&
 complete -F _gzip $filenames gzip
diff --git a/contrib/heimdal b/contrib/heimdal
index 594d719..b39396f 100644
--- a/contrib/heimdal
+++ b/contrib/heimdal
@@ -8,14 +8,14 @@ _heimdal_principals()
 {
 
 	COMPREPLY=( $( compgen -W "$( kadmin -l dump 2>/dev/null | \
-		awk '{print $1}' )" -- $cur ) )
+		awk '{print $1}' )" -- "$cur" ) )
 }
 
 _heimdal_realms()
 {
 
 	COMPREPLY=( $( compgen -W "( kadmin -l dump 2>/dev/null | \
-		awk '{print $1}' | awk -F @ '{print $2}' )" -- $cur ) )
+		awk '{print $1}' | awk -F @ '{print $2}' )" -- "$cur" ) )
 }
 
 _heimdal_encodings()
@@ -23,7 +23,7 @@ _heimdal_encodings()
 
 	COMPREPLY=( $( compgen -W 'des-cbc-mcrc des-cbc-md4 des-cbc-md5 \
 		des3-cbc-sha1 arcfour-hmac-md5 aes128-cts-hmac-sha1-96 \
-		aes256-cts-hmac-sha1-96' -- $cur ) )
+		aes256-cts-hmac-sha1-96' -- "$cur" ) )
 }
 
 
@@ -112,7 +112,7 @@ _ktutil()
 					-v --help'
 				;;
 		esac
-		COMPREPLY=( $( compgen -W "$options" -- $cur ) )
+		COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
 	else
 		case $command in
 			copy)
@@ -125,7 +125,7 @@ _ktutil()
 				_heimdal_principals
 				;;
 			*)
-				COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
+				COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) )
 				;;
 		esac
 	fi
diff --git a/contrib/imagemagick b/contrib/imagemagick
index d0769f4..ee1047e 100644
--- a/contrib/imagemagick
+++ b/contrib/imagemagick
@@ -12,95 +12,95 @@ _ImageMagick()
 	case "$prev" in
 		-channel)
 			COMPREPLY=( $( compgen -W 'Red Green Blue Opacity \
-				Matte Cyan Magenta Yellow Black' -- $cur ) )
+				Matte Cyan Magenta Yellow Black' -- "$cur" ) )
 			return 0
 			;;
 		-colormap)
-			COMPREPLY=( $( compgen -W 'shared private' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'shared private' -- "$cur" ) )
 			return 0
 			;;
 		-colorspace)
 			COMPREPLY=( $( compgen -W 'GRAY OHTA RGB Transparent \
-				XYZ YCbCr YIQ YPbPr YUV CMYK' -- $cur ) )
+				XYZ YCbCr YIQ YPbPr YUV CMYK' -- "$cur" ) )
 			return 0
 			;;
 		-compose)
 			COMPREPLY=( $( compgen -W 'Over In Out Atop Xor Plus \
 				Minus Add Subtract Difference Multiply Bumpmap\
 				Copy CopyRed CopyGreen CopyBlue CopyOpacity' \
-				-- $cur ) )
+				-- "$cur" ) )
 			return 0
 			;;
 		-compress)
 			COMPREPLY=( $( compgen -W 'None BZip Fax Group4 JPEG \
-				Lossless LZW RLE Zip' -- $cur ) )
+				Lossless LZW RLE Zip' -- "$cur" ) )
 			return 0
 			;;
 		-dispose)
 			COMPREPLY=( $( compgen -W 'Undefined None Background \
-						    Previous' -- $cur ) )
+						    Previous' -- "$cur" ) )
 			return 0
 			;;
 		-encoding)
 			COMPREPLY=( $( compgen -W 'AdobeCustom AdobeExpert \
 				AdobeStandard AppleRoman BIG5 GB2312 Latin2 \
-				None SJIScode Symbol Unicode Wansung' -- $cur))
+				None SJIScode Symbol Unicode Wansung' -- "$cur"))
 			return 0
 			;;
 		-endian)
-			COMPREPLY=( $( compgen -W 'MSB LSB' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'MSB LSB' -- "$cur" ) )
 			return 0
 			;;
 		-filter)
 			COMPREPLY=( $( compgen -W 'Point Box Triangle Hermite \
 				Hanning Hamming Blackman Gaussian Quadratic \
 				Cubic Catrom Mitchell Lanczos Bessel Sinc' \
-				-- $cur ) )
+				-- "$cur" ) )
 			return 0
 			;;
 		-format)
 			COMPREPLY=( $( compgen -W "$( convert -list format | \
 				    awk '/ [r-][w-][+-] / {print $1}' | \
 				    tr -d '*' | tr [:upper:] [:lower:] )" \
-				    -- $cur ) )
+				    -- "$cur" ) )
 			return 0
 			;;
 		-gravity)
 			COMPREPLY=( $( compgen -W 'Northwest North NorthEast \
 				West Center East SouthWest South SouthEast' \
-				-- $cur ) )
+				-- "$cur" ) )
 			return 0
 			;;
 		-intent)
 			COMPREPLY=( $( compgen -W 'Absolute Perceptual \
-					Relative Saturation' -- $cur ) )
+					Relative Saturation' -- "$cur" ) )
 			return 0
 			;;
 		-interlace)
 			COMPREPLY=( $( compgen -W 'None Line Plane Partition' \
-					-- $cur ) )
+					-- "$cur" ) )
 			return 0
 			;;
 		-limit)
 			COMPREPLY=( $( compgen -W 'Disk File Map Memory' \
-					-- $cur ) )
+					-- "$cur" ) )
 			return 0
 			;;
 		-list)
 			COMPREPLY=( $( compgen -W 'Delegate Format Magic \
-					Module Resource Type' -- $cur ) )
+					Module Resource Type' -- "$cur" ) )
 			return 0
 			;;
 		-map)
 			COMPREPLY=( $( compgen -W 'best default gray red \
-					green blue' -- $cur ) )
+					green blue' -- "$cur" ) )
 			_filedir
 			return 0
 			;;
 		-noise)
 			COMPREPLY=( $( compgen -W 'Uniform Gaussian \
 					Multiplicative \
-				Impulse Laplacian Poisson' -- $cur ) )
+				Impulse Laplacian Poisson' -- "$cur" ) )
 			return 0
 			;;
 		-preview)
@@ -111,7 +111,7 @@ _ImageMagick()
 					Treshold EdgeDetect Spread Shade \
 					Raise Segment Solarize Swirl Implode \
 					Wave OilPaint CharcoalDrawing JPEG' \
-					-- $cur ) )
+					-- "$cur" ) )
 			return 0
 			;;
 		-@(mask|profile|texture|tile|write))
@@ -122,23 +122,23 @@ _ImageMagick()
 			COMPREPLY=( $( compgen -W 'Bilevel Grayscale Palette \
 					PaletteMatte TrueColor TrueColorMatte \
 					ColorSeparation ColorSeparationlMatte \
-					Optimize' -- $cur ) )
+					Optimize' -- "$cur" ) )
 			return 0
 			;;
 		-units)
 			COMPREPLY=( $( compgen -W 'Undefined PixelsPerInch \
-					PixelsPerCentimeter' -- $cur ) )
+					PixelsPerCentimeter' -- "$cur" ) )
 			return 0
 			;;
 		-virtual-pixel)
 			COMPREPLY=( $( compgen -W 'Constant Edge mirror tile' \
-					-- $cur ) )
+					-- "$cur" ) )
 			return 0
 			;;
 		-visual)
 			COMPREPLY=( $( compgen -W 'StaticGray GrayScale \
 					StaticColor PseudoColor TrueColor \
-					DirectColor defaut visualid' -- $cur ))
+					DirectColor defaut visualid' -- "$cur" ))
 			return 0
 			;;
 	esac
@@ -193,12 +193,12 @@ _convert()
 			-undercolor -unique-colors -units -unsharp -verbose \
 			-version -view -vignette -virtual-pixel -wave \
 			-weight -white-point -white-threshold \
-			-write' -- $cur ) )
+			-write' -- "$cur" ) )
 	elif [[ "$cur" == +* ]]; then
 		COMPREPLY=( $( compgen -W '+adjoin +append +compress \
 			+contrast +debug +dither +endian +gamma +label +map \
 			+mask +matte +negate +noise +page +raise +render \
-			+write' -- $cur ) )
+			+write' -- "$cur" ) )
 	else
 		_filedir
 	fi
@@ -250,11 +250,11 @@ _mogrify()
 			-transverse -treedepth -trim -type -undercolor \
 			-unique-colors -units -unsharp -verbose -version \
 			-view -vignette -virtual-pixel -wave -weight \
-			-white-point -white-threshold' -- $cur ) )
+			-white-point -white-threshold' -- "$cur" ) )
 	elif [[ "$cur" == +* ]]; then
 		COMPREPLY=( $( compgen -W '+compress +contrast +debug +dither \
 			+endian +gamma +label +map +mask +matte +negate +page \
-			+raise' -- $cur ) )
+			+raise' -- "$cur" ) )
 	else
 		_filedir
 	fi
@@ -290,11 +290,11 @@ _display()
 			-shared-memory -sharpen -size -strip -texture -title \
 			-transparent-color -treedepth -trim -update \
 			-usePixmap -verbose -version -virtual-pixel -visual \
-			-window -window-group -write' -- $cur ) )
+			-window -window-group -write' -- "$cur" ) )
 	elif [[ "$cur" == +* ]]; then
 		COMPREPLY=( $( compgen -W '+compress +contrast +debug +dither \
 			+endian +gamma +label +map +matte +negate +page \
-			+raise +write' -- $cur ) )
+			+raise +write' -- "$cur" ) )
 	else
 		_filedir
 	fi
@@ -325,9 +325,9 @@ _animate()
 			-sampling-factor -scenes -seed -set -shared-memory \
 			-size -strip -title -transparent-color -treedepth \
 			-trim -verbose -version -virtual-pixel -visual \
-			-window' -- $cur ) )
+			-window' -- "$cur" ) )
 	elif [[ "$cur" == +* ]]; then
-		COMPREPLY=( $( compgen -W '+debug +dither +gamma +map +matte' -- $cur ) )
+		COMPREPLY=( $( compgen -W '+debug +dither +gamma +map +matte' -- "$cur" ) )
 	else
 		_filedir
 	fi
@@ -350,9 +350,9 @@ _identify()
 			-interpolate -limit -list -log -monitor -ping -quiet \
 			-regard-warnings -respect-parenthesis \
 			-sampling-factor -seed -set -size -strip -units \
-			-verbose -version -virtual-pixel' -- $cur ) )
+			-verbose -version -virtual-pixel' -- "$cur" ) )
 	elif [[ "$cur" == +* ]]; then
-		COMPREPLY=( $( compgen -W '+debug' -- $cur ) )
+		COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) )
 	else
 		_filedir
 	fi
@@ -387,10 +387,10 @@ _montage()
 			-thumbnail -tile -title -transform -transparent \
 			-transparent-color -treedepth -trim -type -units \
 			-verbose -version -virtual-pixel \
-			-white-point' -- $cur ) )
+			-white-point' -- "$cur" ) )
 	elif [[ "$cur" == +* ]]; then
 		COMPREPLY=( $( compgen -W '+adjoin +compress +debug +dither \
-			+endian +gamma +label +matte +page' -- $cur ) )
+			+endian +gamma +label +matte +page' -- "$cur" ) )
 	else
 		_filedir
 	fi
@@ -422,10 +422,10 @@ _composite()
 			-stegano -stereo -strip -swap -thumbnail -tile \
 			-transform -transparent-color -treedepth -type -units \
 			-unsharp -verbose -version -virtual-pixel -watermark \
-			-white-point -write' -- $cur ) )
+			-white-point -write' -- "$cur" ) )
 	elif [[ "$cur" == +* ]]; then
 		COMPREPLY=( $( compgen -W '+compress +debug +dither +endian +label \
-			+matte +negate +page +write' -- $cur ) )
+			+matte +negate +page +write' -- "$cur" ) )
 	else
 		_filedir
 	fi
@@ -450,9 +450,9 @@ _compare()
 			-quality -quantize -quiet -regard-warnings \
 			-respect-parenthesis -sampling-factor -seed -set \
 			-size -transparent-color -type -verbose -version \
-			-virtual-pixel' -- $cur ) )
+			-virtual-pixel' -- "$cur" ) )
 	elif [[ "$cur" == +* ]]; then
-		COMPREPLY=( $( compgen -W '+debug' -- $cur ) )
+		COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) )
 	else
 		_filedir
 	fi
@@ -471,9 +471,9 @@ _conjure()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-debug -help -list -log -monitor \
 			-quiet -regard-warnings -seed -verbose \
-			-version' -- $cur ) )
+			-version' -- "$cur" ) )
 	elif [[ "$cur" == +* ]]; then
-		COMPREPLY=( $( compgen -W '+debug' -- $cur ) )
+		COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) )
 	else
 		_filedir
 	fi
@@ -502,9 +502,9 @@ _import()
 			-scene -screen -seed -set -silent -snaps -strip \
 			-thumbnail -transparent -transparent-color -treedepth \
 			-trim -type -verbose -version -virtual-pixel \
-			-window' -- $cur ) )
+			-window' -- "$cur" ) )
 	elif [[ "$cur" == +* ]]; then
-		COMPREPLY=( $( compgen -W '+debug' -- $cur ) )
+		COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) )
 	else
 		_filedir
 	fi
@@ -527,9 +527,9 @@ _stream()
 			-log -map -monitor -quantize -quiet -regard-warnings \
 			-respect-parenthesis -sampling-factor -seed -set \
 			-size -storage-type -transparent-color -verbose \
-			-version -virtual-pixel' -- $cur ) )
+			-version -virtual-pixel' -- "$cur" ) )
 	elif [[ "$cur" == +* ]]; then
-		COMPREPLY=( $( compgen -W '+debug' -- $cur ) )
+		COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) )
 	else
 		_filedir
 	fi
diff --git a/contrib/ipmitool b/contrib/ipmitool
index 57b8c20..074f34c 100644
--- a/contrib/ipmitool
+++ b/contrib/ipmitool
@@ -15,7 +15,7 @@ _ipmitool()
 	case "$prev" in
 		-I)
 			COMPREPLY=( $( compgen -W 'open imb lan lanplus free' \
-				-- $cur ) )
+				-- "$cur" ) )
 			return 0
 			;;
 	esac
@@ -24,12 +24,12 @@ _ipmitool()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-h -V -v -c -d -I -H -p -U -f -S -a \
 			-e -C -k -y -K -A -P -E -K -m -b -r -B -T -l -o -O' \
-			-- $cur ) )
+			-- "$cur" ) )
 	else
 		COMPREPLY=( $( compgen -W 'raw i2c spd lan chassis power event \
 			mc sdr sensor fru gendev sel pef sol tsol isol user \
 			channel session sunoem kontronoem picmg fwum firewall \
-			exec set hpm ekanalyzer' -- $cur ) )
+			exec set hpm ekanalyzer' -- "$cur" ) )
 	fi
 
 } &&
diff --git a/contrib/iptables b/contrib/iptables
index 77714c6..bb85139 100644
--- a/contrib/iptables
+++ b/contrib/iptables
@@ -26,27 +26,27 @@ _iptables()
 	case "$prev" in
 	-*[AIDRPFXLZ])
 		COMPREPLY=( $( compgen -W '`iptables $table -nL | \
-			    sed -ne "s/^Chain \([^ ]\+\).*$/\1/p"`' -- $cur ) )
+			    sed -ne "s/^Chain \([^ ]\+\).*$/\1/p"`' -- "$cur" ) )
 		;;
 	-*t)
-		COMPREPLY=( $( compgen -W 'nat filter mangle' -- $cur ) )
+		COMPREPLY=( $( compgen -W 'nat filter mangle' -- "$cur" ) )
 		;;
 	-j)
 		if [ "$table" = "-t filter" -o "$table" = "" ]; then
 		    COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \
 		    `iptables $table -nL | sed -ne "$chain" \
 		    -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \
-		    $cur ) )
+		    "$cur" ) )
 		elif [ "$table" = "-t nat" ]; then
 		    COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \
 		    MIRROR SNAT DNAT MASQUERADE `iptables $table -nL | \
 		    sed -ne "$chain" -e "s/OUTPUT|PREROUTING|POSTROUTING//"`' \
-		    -- $cur ) )
+		    -- "$cur" ) )
 		elif [ "$table" = "-t mangle" ]; then
 		    COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \
 		    MARK TOS `iptables $table -nL | sed -ne "$chain" \
 		    -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \
-		    $cur ) )
+		    "$cur" ) )
 		fi
 		;;
 	*)
diff --git a/contrib/isql b/contrib/isql
index a856ef2..10f7d33 100644
--- a/contrib/isql
+++ b/contrib/isql
@@ -9,6 +9,6 @@ _isql()
 	local cur
 	cur=`_get_cword`
 
-	[ -f "$ODBCINI" ] && COMPREPLY=( $( grep \\[$cur "$ODBCINI" | tr -d \\[\\] ) )
+	[ -f "$ODBCINI" ] && COMPREPLY=( $( grep \\["$cur" "$ODBCINI" | tr -d \\[\\] ) )
 } &&
 complete -F _isql isql
diff --git a/contrib/jar b/contrib/jar
index 7d18818..edbfe5b 100644
--- a/contrib/jar
+++ b/contrib/jar
@@ -12,7 +12,7 @@ _jar()
 	cur=`_get_cword`
 
 	if [ $COMP_CWORD = 1 ]; then
-		COMPREPLY=( $( compgen -W 'c t x u' -- $cur ) )
+		COMPREPLY=( $( compgen -W 'c t x u' -- "$cur" ) )
 		return 0
 	fi
 
diff --git a/contrib/java b/contrib/java
index 1d76a8d..fb8450a 100644
--- a/contrib/java
+++ b/contrib/java
@@ -159,7 +159,7 @@ _java()
 				-showversion -? -help -X -jar \
 				-ea -enableassertions -da -disableassertions \
 				-esa -enablesystemassertions \
-				-dsa -disablesystemassertions ' -- $cur ) )
+				-dsa -disablesystemassertions ' -- "$cur" ) )
 	else
 		if [[ "$prev" == -jar ]]; then
 			# jar file completion
@@ -212,7 +212,7 @@ _javadoc()
 				-nohelp -nonavbar -quiet -serialwarn -tag \
 				-taglet -tagletpath -charset -helpfile \
 				-linksource -stylesheetfile -docencoding' -- \
-				$cur ) )
+				"$cur" ) )
 	else
 		# source files completion
 		_filedir java
@@ -247,7 +247,7 @@ _javac()
 		COMPREPLY=( $( compgen -W '-g -g:none -g:lines -g:vars\
 		-g:source -O -nowarn -verbose -deprecation -classpath\
 		-sourcepath -bootclasspath -extdirs -d -encoding -source\
-		-target -help' -- $cur ) )
+		-target -help' -- "$cur" ) )
 	else
 		# source files completion
 		_filedir java
diff --git a/contrib/kldload b/contrib/kldload
index 27abfc2..c14d598 100644
--- a/contrib/kldload
+++ b/contrib/kldload
@@ -14,7 +14,7 @@ _kldload()
 	[ -d $moddir ] || moddir=/boot/kernel/
 	cur=`_get_cword`
 
-	COMPREPLY=( $( compgen -f $moddir$cur ) )
+	COMPREPLY=( $( compgen -f "$moddir$cur" ) )
 	COMPREPLY=( ${COMPREPLY[@]#$moddir} )
 	COMPREPLY=( ${COMPREPLY[@]%.ko} )
 
diff --git a/contrib/larch b/contrib/larch
index 41b2b3f..8ba72ae 100644
--- a/contrib/larch
+++ b/contrib/larch
@@ -32,7 +32,7 @@ library-archives library-categories library-branches library-versions       \
 library-revisions library-log library-file touched-files-prereqs            \
 patch-set-web update-distributions distribution-name notify my-notifier     \
 mail-new-categories mail-new-branches mail-new-versions mail-new-revisions  \
-notify-library notify-browser push-new-revisions sendmail-mailx' $cur ))
+notify-library notify-browser push-new-revisions sendmail-mailx' "$cur" ))
 	fi
 
 	return 0
diff --git a/contrib/ldapvi b/contrib/ldapvi
index 460db60..de55c6f 100644
--- a/contrib/ldapvi
+++ b/contrib/ldapvi
@@ -19,11 +19,11 @@ _ldapvi()
 			;;
 		-@(Y|-sasl-mech))
 			COMPREPLY=( $( compgen -W 'EXTERNAL GSSAPI DIGEST-MD5 \
-				CRAM-MD5 PLAIN ANONYMOUS' -- $cur ) )
+				CRAM-MD5 PLAIN ANONYMOUS' -- "$cur" ) )
 			return 0
 			;;
 		--bind)
-			COMPREPLY=( $( compgen -W 'simple sasl' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'simple sasl' -- "$cur" ) )
 			return 0
 			;;
 		--bind-dialog)
@@ -32,22 +32,22 @@ _ldapvi()
 			return 0
 			;;
 		--scope)
-			COMPREPLY=( $( compgen -W 'base one sub' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'base one sub' -- "$cur" ) )
 			return 0
 			;;
 		--deref)
 			COMPREPLY=( $( compgen -W 'never searching finding \
-				always' -- $cur ) )
+				always' -- "$cur" ) )
 			return 0
 			;;
 		--encoding)
 			COMPREPLY=( $( compgen -W 'ASCII UTF-8 binary' \
-				-- $cur ) )
+				-- "$cur" ) )
 			return 0
 			;;
 		--tls)
 			COMPREPLY=( $( compgen -W 'never allow try strict' \
-				-- $cur ) )
+				-- "$cur" ) )
 			return 0
 			;;
 	esac
@@ -64,7 +64,7 @@ _ldapvi()
 			--managedsait --noquestions -! --noninteractive -q \
 			--quiet -R --read -Z --starttls --tls -v --verbose \
 			--ldapsearch --ldapmodify --ldapdelete --ldapmoddn' \
-			-- $cur ) )
+			-- "$cur" ) )
 	fi
 } &&
 complete -F _ldapvi ldapvi
diff --git a/contrib/lftp b/contrib/lftp
index 9a53200..c8bd69c 100644
--- a/contrib/lftp
+++ b/contrib/lftp
@@ -13,7 +13,7 @@ _lftp()
 
 	if [ $COMP_CWORD -eq 1 ] && [ -f ~/.lftp/bookmarks ]; then
 	    COMPREPLY=( $( compgen -W '$( sed -ne "s/^\(.*\)'$'\t''.*$/\1/p" \
-			   ~/.lftp/bookmarks )' -- $cur ) )
+			   ~/.lftp/bookmarks )' -- "$cur" ) )
 	fi
 
 	return 0
diff --git a/contrib/lilo b/contrib/lilo
index dc8b0c3..aaa82b1 100644
--- a/contrib/lilo
+++ b/contrib/lilo
@@ -7,7 +7,7 @@ have lilo && {
 _lilo_labels()
 {
 	COMPREPLY=( $( compgen -W "$( awk -F'=' '/label/ {print $2}' \
-		/etc/lilo.conf | sed -e 's/\"//g' )" -- $cur ) )
+		/etc/lilo.conf | sed -e 's/\"//g' )" -- "$cur" ) )
 }
 
 _lilo()
@@ -41,7 +41,7 @@ _lilo()
 		-T)
 			# topic completion
 			COMPREPLY=( $( compgen -W 'help ChRul EBDA geom geom= \
-					table= video' -- $cur ) )
+					table= video' -- "$cur" ) )
 			return 0
 			;;
 	esac
@@ -50,7 +50,7 @@ _lilo()
 		# relevant options completion
 		COMPREPLY=( $( compgen -W '-A -b -c -C -d -f -g -i -I -l -L -m \
 			-M -p -P -q -r -R -s -S -t -T -u -U -v -V -w -x -z' -- \
-			$cur ) )
+			"$cur" ) )
 	fi
 }
 complete -F _lilo lilo
diff --git a/contrib/links b/contrib/links
index bbd39c2..51f3795 100644
--- a/contrib/links
+++ b/contrib/links
@@ -13,7 +13,7 @@ _links()
 
 	case "$cur" in
 	    --*)
-		COMPREPLY=( $( compgen -W '--help' -- $cur ) )
+		COMPREPLY=( $( compgen -W '--help' -- "$cur" ) )
 		;;
 	    -*)
 		COMPREPLY=( $( compgen -W '-async-dns -max-connections \
@@ -22,12 +22,12 @@ _links()
 				-format-cache-size -memory-cache-size \
 				-http-proxy -ftp-proxy -download-dir \
 				-assume-codepage -anonymous -dump -no-connect \
-				-source -version -help' -- $cur ) )
+				-source -version -help' -- "$cur" ) )
 		;;
 	    *)
 		if [ -r ~/.links/links.his ]; then
 		    COMPREPLY=( $( compgen -W '$( < ~/.links/links.his )' \
-				   -- $cur ) )
+				   -- "$cur" ) )
 		fi
 				_filedir '@(htm|html)'
 				return 0
diff --git a/contrib/lisp b/contrib/lisp
index 656b865..95f2900 100644
--- a/contrib/lisp
+++ b/contrib/lisp
@@ -17,7 +17,7 @@ _lisp()
 	COMPREPLY=( $( compgen -W '-core -lib -batch -quit -edit -eval -init \
                      -dynamic-space-size -hinit -noinit -nositeinit -load \
                      -slave ' \
-                     -- $cur ) )
+                     -- "$cur" ) )
     else
 	_filedir
     fi
diff --git a/contrib/lvm b/contrib/lvm
index 4049a2a..5e0b610 100644
--- a/contrib/lvm
+++ b/contrib/lvm
@@ -7,29 +7,29 @@ have lvm && {
 _volumegroups()
 {
 	COMPREPLY=( $(compgen -W "$( vgscan 2>/dev/null | \
-	    sed -n -e 's|.*Found.*"\(.*\)".*$|\1|p' )" -- $cur ) )
+	    sed -n -e 's|.*Found.*"\(.*\)".*$|\1|p' )" -- "$cur" ) )
 }
 
 _physicalvolumes()
 {
 	COMPREPLY=( $(compgen -W "$( pvscan 2>/dev/null | \
-	    sed -n -e 's|^.*PV \(.*\) VG.*$|\1|p' )" -- $cur ) )
+	    sed -n -e 's|^.*PV \(.*\) VG.*$|\1|p' )" -- "$cur" ) )
 }
 
 _logicalvolumes()
 {
 	COMPREPLY=( $(compgen -W "$( lvscan 2>/dev/null | \
-	    sed -n -e "s|^.*'\(.*\)'.*$|\1|p" )" -- $cur ) )
+	    sed -n -e "s|^.*'\(.*\)'.*$|\1|p" )" -- "$cur" ) )
 }
 
 _units()
 {
-	COMPREPLY=( $( compgen -W 'h s b k m g t H K M G T' -- $cur ) )
+	COMPREPLY=( $( compgen -W 'h s b k m g t H K M G T' -- "$cur" ) )
 }
 
 _sizes()
 {
-	COMPREPLY=( $( compgen -W 'k K m M g G t T' -- $cur ) )
+	COMPREPLY=( $( compgen -W 'k K m M g G t T' -- "$cur" ) )
 }
 
 _args()
@@ -56,7 +56,7 @@ _lvmdiskscan()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-d --debug -h -? --help -l \
-			--lvmpartition -v --verbose --version' -- $cur ) )
+			--lvmpartition -v --verbose --version' -- "$cur" ) )
 	fi
 }
 complete -F _lvmdiskscan lvmdiskscan
@@ -73,7 +73,7 @@ _pvscan()
 			--exported -n --novolumegroup -h -? \
 			--help --ignorelockingfailure -P \
 			--partial -s --short -u --uuid -v \
-			--verbose --version' -- $cur ) )
+			--verbose --version' -- "$cur" ) )
 	fi
 }
 complete -F _pvscan pvscan
@@ -91,7 +91,7 @@ _pvs()
 			COMPREPLY=( $( compgen -W 'pv_fmt pv_uuid \
 				pv_size pv_free pv_used pv_name \
 				pv_attr pv_pe_count \
-				pv_pe_alloc_count' -- $cur ) )
+				pv_pe_alloc_count' -- "$cur" ) )
 			return 0
 			;;
 		--units)
@@ -105,7 +105,7 @@ _pvs()
 			-h -? --help --ignorelockingfailure --noheadings \
 			--nosuffix -o --options -O --sort \
 			--separator --unbuffered --units \
-			-v --verbose --version' -- $cur ) )
+			-v --verbose --version' -- "$cur" ) )
 	else
 		_physicalvolumes
 	fi
@@ -129,7 +129,7 @@ _pvdisplay()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-c --colon -C --columns --units \
-			-v --verbose -d --debug -h --help --version' -- $cur ) )
+			-v --verbose -d --debug -h --help --version' -- "$cur" ) )
 	else
 		_physicalvolumes
 	fi
@@ -146,7 +146,7 @@ _pvchange()
 
 	case "$prev" in
 		-@(A|x|-autobackup|--allocatable))
-			COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
 			return 0
 			;;
 	esac
@@ -155,7 +155,7 @@ _pvchange()
 		COMPREPLY=( $( compgen -W '-a --all -A --autobackup \
 			-d --debug -h --help -t --test -u --uuid -x \
 			--allocatable -v --verbose --addtag --deltag \
-			--version' -- $cur ) )
+			--version' -- "$cur" ) )
 	else
 		_physicalvolumes
 	fi
@@ -176,11 +176,11 @@ _pvcreate()
 			return 0
 			;;
 		-@(M|-metadatatype))
-			COMPREPLY=( $( compgen -W '1 2' -- $cur ) )
+			COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) )
 			return 0
 			;;
 		--metadatacopies)
-			COMPREPLY=( $( compgen -W '0 1 2' -- $cur ) )
+			COMPREPLY=( $( compgen -W '0 1 2' -- "$cur" ) )
 			return 0
 			;;
 		--@(metadatasize|setphysicalvolumesize))
@@ -194,7 +194,7 @@ _pvcreate()
 			--force -h -? --help --labelsector -M --metadatatype \
 			--metadatacopies --metadatasize \
 			--setphysicalvolumesize -t --test -u --uuid uuid -v \
-			--verbose -y --yes --version' -- $cur ) )
+			--verbose -y --yes --version' -- "$cur" ) )
 	else
 		_physicalvolumes
 	fi
@@ -211,7 +211,7 @@ _pvmove()
 
 	case "$prev" in
 		-@(A|-autobackup))
-			COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
 			return 0
 			;;
 		-@(n|-name))
@@ -223,7 +223,7 @@ _pvmove()
 		COMPREPLY=( $( compgen -W '--abort -A --autobackup \
 			-b --background -d --debug -f --force -h -? \
 			--help -i --interval -t --test -v --verbose \
-			--version -n --name' -- $cur ) )
+			--version -n --name' -- "$cur" ) )
 	else
 		_physicalvolumes
 	fi
@@ -240,7 +240,7 @@ _pvremove()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-d --debug -f --force -h -? \
 			--help -y --yes -t --test -v --verbose \
-			--version' -- $cur ) )
+			--version' -- "$cur" ) )
 	else
 		_physicalvolumes
 	fi
@@ -257,7 +257,7 @@ _vgscan()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-d --debug -h --help \
 			--ignorelockingfailure --mknodes -P \
-			--partial -v --verbose --version' -- $cur ) )
+			--partial -v --verbose --version' -- "$cur" ) )
 	fi
 }
 complete -F _vgscan vgscan
@@ -276,7 +276,7 @@ _vgs()
 				vg_attr vg_size vg_free vg_sysid \
 				vg_extent_size vg_extent_count vg_free_count \
 				max_lv max_pv pv_count lv_count snap_count \
-				vg_seqno' -- $cur ) )
+				vg_seqno' -- "$cur" ) )
 			return 0
 			;;
 		--units)
@@ -290,7 +290,7 @@ _vgs()
 			-h --help --ignorelockingfailure --noheadings \
 			--nosuffix -o --options -O --sort -P --partial \
 			--separator --unbuffered --units \
-			-v --verbose --version' -- $cur ) )
+			-v --verbose --version' -- "$cur" ) )
 	else
 		_volumegroups
 	fi
@@ -315,7 +315,7 @@ _vgdisplay()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-c --colon -C --columns --units \
 			-P --partial -A --activevolumegroups -v --verbose \
-			-d --debug -h --help --version' -- $cur ) )
+			-d --debug -h --help --version' -- "$cur" ) )
 	else
 		_volumegroups
 	fi
@@ -332,7 +332,7 @@ _vgchange()
 
 	case "$prev" in
 		-@(a|A|x|-available|-autobackup|-resizeable))
-			COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
 			return 0
 			;;
 	esac
@@ -342,7 +342,7 @@ _vgchange()
 			--partial -d --debug -h --help --ignorelockingfailure \
 			-t --test -u --uuid -v --verbose --version -a \
 			--available -x --resizeable -l --logicalvolume \
-			--addtag --deltag' -- $cur ) )
+			--addtag --deltag' -- "$cur" ) )
 	else
 		_volumegroups
 	fi
@@ -359,11 +359,11 @@ _vgcreate()
 
 	case "$prev" in
 		-@(A|-autobackup))
-			COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
 			return 0
 			;;
 		-@(M|-metadatatype))
-			COMPREPLY=( $( compgen -W '1 2' -- $cur ) )
+			COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) )
 			return 0
 			;;
 		-@(s|-physicalextentsize))
@@ -377,7 +377,7 @@ _vgcreate()
 			--alloc -d --debug -h --help -l --maxlogicalvolumes \
 			-M --metadatatype -p --maxphysicalvolumes -s \
 			--physicalextentsize -t --test -v --verbose \
-			--version' -- $cur ) )
+			--version' -- "$cur" ) )
 	else
 		_args
 		if [ $args -eq 0 ]; then
@@ -398,7 +398,7 @@ _vgremove()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-d --debug -h --help -t --test \
-		-v --verbose --version' -- $cur ) )
+		-v --verbose --version' -- "$cur" ) )
 	else
 		_volumegroups
 	fi
@@ -415,14 +415,14 @@ _vgrename()
 
 	case "$prev" in
 		-@(A|-autobackup))
-			COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
 			return 0
 			;;
 	esac
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -h \
-			-? --help -t --test -v --verbose --version' -- $cur ) )
+			-? --help -t --test -v --verbose --version' -- "$cur" ) )
 	else
 		_volumegroups
 	fi
@@ -439,7 +439,7 @@ _vgreduce()
 
 	case "$prev" in
 		-@(A|-autobackup))
-			COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
 			return 0
 			;;
 	esac
@@ -447,7 +447,7 @@ _vgreduce()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-a --all -A --autobackup -d \
 			--debug -h --help --removemissing -t --test -v \
-			--verbose --version' -- $cur ) )
+			--verbose --version' -- "$cur" ) )
 
 	else
 		_args
@@ -470,7 +470,7 @@ _vgextend()
 
 	case "$prev" in
 		-@(A|-autobackup))
-			COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
 			return 0
 			;;
 		-@(L|-size))
@@ -481,7 +481,7 @@ _vgextend()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -h \
-			-? --help -t --test -v --verbose --version' -- $cur ) )
+			-? --help -t --test -v --verbose --version' -- "$cur" ) )
 	else
 		_args
 		if [ $args -eq 0 ]; then
@@ -502,7 +502,7 @@ _vgport()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-a --all -d --debug -h \
-			-? --help -v --verbose --version' -- $cur ) )
+			-? --help -v --verbose --version' -- "$cur" ) )
 	else
 		_volumegroups
 	fi
@@ -518,7 +518,7 @@ _vgck()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-d --debug -h \
-			-? --help -v --verbose --version' -- $cur ) )
+			-? --help -v --verbose --version' -- "$cur" ) )
 	else
 		_volumegroups
 	fi
@@ -535,11 +535,11 @@ _vgconvert()
 
 	case "$prev" in
 		-@(M|-metadatatype))
-			COMPREPLY=( $( compgen -W '1 2' -- $cur ) )
+			COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) )
 			return 0
 			;;
 		--metadatacopies)
-			COMPREPLY=( $( compgen -W '0 1 2' -- $cur ) )
+			COMPREPLY=( $( compgen -W '0 1 2' -- "$cur" ) )
 			return 0
 			;;
 		--metadatasize)
@@ -551,7 +551,7 @@ _vgconvert()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-d --debug -h --help --labelsector \
 			-M --metadatatype --metadatacopies --metadatasize \
-			-t --test -v --verbose --version' -- $cur ) )
+			-t --test -v --verbose --version' -- "$cur" ) )
 	else
 		_volumegroups
 	fi
@@ -576,7 +576,7 @@ _vgcfgbackup()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-d --debug -f --file -h --help \
 			--ignorelockingfailure -P --partial -v --verbose \
-			--version' -- $cur ) )
+			--version' -- "$cur" ) )
 	else
 		_volumegroups
 	fi
@@ -597,7 +597,7 @@ _vgcfgrestore()
 			return 0
 			;;
 		-@(M|-metadatatype))
-			COMPREPLY=( $( compgen -W '1 2' -- $cur ) )
+			COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) )
 			return 0
 			;;
 		-@(n|-name))
@@ -609,7 +609,7 @@ _vgcfgrestore()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-d --debug -f --file -l --list \
 			-h --help -M --Metadatatype -n --name -t --test \
-			-v --verbose --version' -- $cur ) )
+			-v --verbose --version' -- "$cur" ) )
 	else
 		_volumegroups
 	fi
@@ -626,7 +626,7 @@ _vgmerge()
 
 	case "$prev" in
 		-@(A|-autobackup))
-			COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
 			return 0
 			;;
 	esac
@@ -634,7 +634,7 @@ _vgmerge()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-A --autobackup -d --debug \
 			-h --help -l --list -t --test -v --verbose \
-			--version' -- $cur ) )
+			--version' -- "$cur" ) )
 	else
 		_volumegroups
 	fi
@@ -651,11 +651,11 @@ _vgsplit()
 
 	case "$prev" in
 		-@(A|-autobackup))
-			COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
 			return 0
 			;;
 		-@(M|-metadatatype))
-			COMPREPLY=( $( compgen -W '1 2' -- $cur ) )
+			COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) )
 			return 0
 			;;
 	esac
@@ -663,7 +663,7 @@ _vgsplit()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-A --autobackup -d --debug \
 			-h --help -l --list -M --metadatatype -t --test \
-			-v --verbose --version' -- $cur ) )
+			-v --verbose --version' -- "$cur" ) )
 	else
 		_args
 		if [ $args -eq 0 -o $args -eq 1 ]; then
@@ -684,7 +684,7 @@ _vgmknodes()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-d --debug -h --help -v --verbose \
-			--version' -- $cur ) )
+			--version' -- "$cur" ) )
 	else
 		_volumegroups
 	fi
@@ -701,7 +701,7 @@ _lvscan()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-b --blockdevice -d --debug \
 			-h -? --help --ignorelockingfailure -P \
-			--partial -v --verbose --version' -- $cur ) )
+			--partial -v --verbose --version' -- "$cur" ) )
 	fi
 }
 complete -F _lvscan lvscan
@@ -720,7 +720,7 @@ _lvs()
 				lv_attr lv_minor lv_size seg_count \
 				origin snap_percent segtype stripes \
 				stripesize chunksize seg_start \
-				seg_size' -- $cur ) )
+				seg_size' -- "$cur" ) )
 			return 0
 			;;
 		--units)
@@ -734,7 +734,7 @@ _lvs()
 			-h --help --ignorelockingfailure --noheadings \
 			--nosuffix -o --options -O --sort -P --partial \
 			--segments --separator --unbuffered --units \
-			-v --verbose --version' -- $cur ) )
+			-v --verbose --version' -- "$cur" ) )
 	else
 		_logicalvolumes
 	fi
@@ -759,7 +759,7 @@ _lvdisplay()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-c --colon -C --columns --units \
 			-P --partial -m --maps -v --verbose -d --debug -h \
-			--help --version' -- $cur ) )
+			--help --version' -- "$cur" ) )
 	else
 		_logicalvolumes
 	fi
@@ -776,11 +776,11 @@ _lvchange()
 
 	case "$prev" in
 		-@(a|A|C|M|-available|-autobackup|-continguous|-persistent))
-			COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
 			return 0
 			;;
 		-@(p|-permission))
-			COMPREPLY=( $( compgen -W 'r rw' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'r rw' -- "$cur" ) )
 			return 0
 			;;
 	esac
@@ -791,7 +791,7 @@ _lvchange()
 			-f --force -h --help --ignorelockingfailure -M \
 			--persistent --major major --minor minor -P --partial \
 			-p --permission -r --readahead --refresh -t --test \
-			-v --verbose --version' -- $cur ) )
+			-v --verbose --version' -- "$cur" ) )
 	else
 		_logicalvolumes
 	fi
@@ -808,7 +808,7 @@ _lvcreate()
 
 	case "$prev" in
 		-@(A|C|M|Z|-autobackup|-continguous|-persistent|-zero))
-			COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
 			return 0
 			;;
 		-@(L|-size))
@@ -816,7 +816,7 @@ _lvcreate()
 			return 0
 			;;
 		-@(p|-permission))
-			COMPREPLY=( $( compgen -W 'r rw' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'r rw' -- "$cur" ) )
 			return 0
 			;;
 		-@(n|-name))
@@ -831,7 +831,7 @@ _lvcreate()
 			-I --stripesize -l --extents -L --size -M --persistent \
 			--major --minor -n --name -p --permission -r \
 			--readahead -t --test --type -v --verbose -Z --zero \
-			--version' -- $cur ) )
+			--version' -- "$cur" ) )
 	else
 		_args
 		if [ $args -eq 0 ]; then
@@ -853,7 +853,7 @@ _lvremove()
 
 	case "$prev" in
 		-@(A|-autobackup))
-			COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
 			return 0
 			;;
 	esac
@@ -861,7 +861,7 @@ _lvremove()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -f \
 			--force -h -?  --help -t --test -v --verbose \
-			--version' -- $cur ) )
+			--version' -- "$cur" ) )
 	else
 		_logicalvolumes
 	fi
@@ -878,14 +878,14 @@ _lvrename()
 
 	case "$prev" in
 		-@(A|-autobackup))
-			COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
 			return 0
 			;;
 	esac
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -h \
-			-? --help -t --test -v --verbose --version' -- $cur ) )
+			-? --help -t --test -v --verbose --version' -- "$cur" ) )
 	else
 		_logicalvolumes
 	fi
@@ -902,7 +902,7 @@ _lvreduce()
 
 	case "$prev" in
 		-@(A|-autobackup))
-			COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
 			return 0
 			;;
 		-@(L|-size))
@@ -915,7 +915,7 @@ _lvreduce()
 		COMPREPLY=( $( compgen -W '-A --autobackup -d \
 			--debug -f --force -h --help -l --extents \
 			-L --size -n --nofsck -r --resizefs -t --test \
-			-v --verbose --version' -- $cur ) )
+			-v --verbose --version' -- "$cur" ) )
 	else
 		_logicalvolumes
 	fi
@@ -932,7 +932,7 @@ _lvresize()
 
 	case "$prev" in
 		-@(A|-autobackup))
-			COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
 			return 0
 			;;
 		-@(L|-size))
@@ -945,7 +945,7 @@ _lvresize()
 		COMPREPLY=( $( compgen -W '-A --autobackup --alloc -d \
 			--debug -h --help -i --stripes -I --stripesize \
 			-l --extents -L --size -n --nofsck -r --resizefs \
-			-t --test --type -v --verbose --version' -- $cur ) )
+			-t --test --type -v --verbose --version' -- "$cur" ) )
 	else
 		_args
 		if [ $args -eq 0 ]; then
@@ -967,7 +967,7 @@ _lvextend()
 
 	case "$prev" in
 		-@(A|-autobackup))
-			COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
 			return 0
 			;;
 		-@(L|-size))
@@ -980,7 +980,7 @@ _lvextend()
 		COMPREPLY=( $( compgen -W '-A --autobackup --alloc -d \
 			--debug -h --help -i --stripes -I --stripesize \
 			-l --extents -L --size -n --nofsck -r --resizefs \
-			-t --test --type -v --verbose --version' -- $cur ) )
+			-t --test --type -v --verbose --version' -- "$cur" ) )
 	else
 		_args
 		if [ $args -eq 0 ]; then
@@ -1010,7 +1010,7 @@ _lvm()
 			vgcreate vgdisplay vgexport vgextend \
 			vgimport vgmerge vgmknodes vgreduce \
 			vgremove vgrename vgs vgscan vgsplit \
-			version' -- $cur ) )
+			version' -- "$cur" ) )
 	else
 		case ${COMP_WORDS[1]} in
 			pvchange)
diff --git a/contrib/lzma b/contrib/lzma
index 99005bc..a366f0e 100644
--- a/contrib/lzma
+++ b/contrib/lzma
@@ -17,7 +17,7 @@ _lzma()
 			-v -V -z -1 -2 -3 -4 -5 -6 -7 -8 -9 \
 			--help --decompress --compress --keep --force \
 			--test --stdout --quiet --verbose --license \
-			--version --small --fast --best --text' -- $cur ) )
+			--version --small --fast --best --text' -- "$cur" ) )
 		return 0
 	fi
 
@@ -36,7 +36,7 @@ _lzma()
 
 	_expand || return 0
 
-	COMPREPLY=( $( compgen -f -X "$xspec" -- $cur ) \
-		$( compgen -d -- $cur ) )
+	COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
+		$( compgen -d -- "$cur" ) )
 } &&
 complete -F _lzma $filenames lzma
diff --git a/contrib/lzop b/contrib/lzop
index 59a7a42..a0e6006 100644
--- a/contrib/lzop
+++ b/contrib/lzop
@@ -24,7 +24,7 @@ _lzop()
 			--no-time --suffix --keep --unlink --delete --crc32 \
 			--no-warn --ignore-warn --quiet --silent --verbose \
 			--no-stdin --filter --checksum --no-color --mono \
-			--color' -- $cur ) )
+			--color' -- "$cur" ) )
 		return 0
 	fi
 
@@ -47,7 +47,7 @@ _lzop()
 	_expand || return 0
 
 	local IFS=$'\t\n'
-	COMPREPLY=( $( compgen -f -X "$xspec" -- $cur ) \
-		    $( compgen -d -- $cur ) )
+	COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
+		    $( compgen -d -- "$cur" ) )
 } &&
 complete -F _lzop $filenames lzop
diff --git a/contrib/mailman b/contrib/mailman
index 5b19dff..9ada7eb 100644
--- a/contrib/mailman
+++ b/contrib/mailman
@@ -6,7 +6,7 @@
 have list_lists && {
 _mailman_lists()
 {
-	COMPREPLY=( $( compgen -W '$( list_lists -b )' -- $cur ) )
+	COMPREPLY=( $( compgen -W '$( list_lists -b )' -- "$cur" ) )
 }
 
 _list_lists()
@@ -19,7 +19,7 @@ _list_lists()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-a --advertised \
 			--virtual-host-overview -V -b --bare \
-			-h --help' -- $cur ) )
+			-h --help' -- "$cur" ) )
 	fi
 
 } &&
@@ -43,7 +43,7 @@ _add_members()
 			return 0
 			;;
 		-@(w|a|-welcome-msg|-admin-notify))
-			COMPREPLY=( $( compgen -W 'y n' -- $cur) )
+			COMPREPLY=( $( compgen -W 'y n' -- "$cur") )
 			return 0
 			;;
 	esac
@@ -53,7 +53,7 @@ _add_members()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '--regular-members-file -r \
 			--digest-members-file -d --welcome-msg -w \
-			--admin-notify -a --help -h' -- $cur ) )
+			--admin-notify -a --help -h' -- "$cur" ) )
 	else
 		_mailman_lists
 	fi
@@ -84,7 +84,7 @@ _remove_members()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '--file -f --all -a \
 			--fromall --nouserack -n --noadminack -N \
-			--help -h' -- $cur ) )
+			--help -h' -- "$cur" ) )
 	else
 		_mailman_lists
 	fi
@@ -114,7 +114,7 @@ _find_member()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-l --listname -x \
-			--exclude --owners -w --help -h' -- $cur ) )
+			--exclude --owners -w --help -h' -- "$cur" ) )
 	fi
 
 } &&
@@ -142,7 +142,7 @@ _clone_member()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-l --listname --remove -r \
-		--admin -a --quiet -q --nomodify -n --help -h' -- $cur ) )
+		--admin -a --quiet -q --nomodify -n --help -h' -- "$cur" ) )
 	fi
 
 } &&
@@ -161,7 +161,7 @@ _sync_members()
 
 	case "$prev" in
 		-@(w|g|d|--welcome-msg|-goodbye-msg|-digest))
-			COMPREPLY=( $( compgen -W 'y n' -- $cur) )
+			COMPREPLY=( $( compgen -W 'y n' -- "$cur") )
 			return 0
 			;;
 		-@(d|-file))
@@ -175,7 +175,7 @@ _sync_members()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '--no-change -n --welcome-msg -w \
 			--goodbye-msg -g --digest -d --notifyadmin -a \
-			-f --file -h --help' -- $cur ) )
+			-f --file -h --help' -- "$cur" ) )
 	else
 		_mailman_lists
 	fi
@@ -192,7 +192,7 @@ _unshunt()
 	cur=`_get_cword`
 
 	if [[ "$cur" == -* ]]; then
-		COMPREPLY=( $( compgen -W '-h --help' -- $cur ) )
+		COMPREPLY=( $( compgen -W '-h --help' -- "$cur" ) )
 	else
 		_filedir -d
 	fi
@@ -210,7 +210,7 @@ _list_admins()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '--all-vhost -v \
-			--all -a -h --help' -- $cur ) )
+			--all -a -h --help' -- "$cur" ) )
 	else
 		_mailman_lists
 	fi
@@ -228,7 +228,7 @@ _list_owners()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-w --with-listnames \
-			-m --moderators -h --help' -- $cur ) )
+			-m --moderators -h --help' -- "$cur" ) )
 	else
 		_mailman_lists
 	fi
@@ -253,11 +253,11 @@ _list_members()
 			return 0
 			;;
 		-@(d|-digest))
-			COMPREPLY=( $( compgen -W 'mime plain' -- $cur) )
+			COMPREPLY=( $( compgen -W 'mime plain' -- "$cur") )
 			return 0
 			;;
 		-@(n|-nomail))
-			COMPREPLY=( $( compgen -W 'byadmin byuser bybounce unknown' -- $cur) )
+			COMPREPLY=( $( compgen -W 'byadmin byuser bybounce unknown' -- "$cur") )
 			return 0
 			;;
 	esac
@@ -267,7 +267,7 @@ _list_members()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '--output -o --regular -r \
 			--digest -d --nomail -n --fullnames -f \
-			--preserve -p -h --help' -- $cur ) )
+			--preserve -p -h --help' -- "$cur" ) )
 	else
 		_mailman_lists
 	fi
@@ -297,7 +297,7 @@ _change_pw()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-a --all --domain -d --listname -l \
-			--password -p --quiet -q -h --help' -- $cur ) )
+			--password -p --quiet -q -h --help' -- "$cur" ) )
 	fi
 
 } &&
@@ -313,7 +313,7 @@ _withlist()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-l --lock -i --interactive \
-			-r --run -a --all -q --quiet -h --help' -- $cur ) )
+			-r --run -a --all -q --quiet -h --help' -- "$cur" ) )
 	else
 		_mailman_lists
 	fi
@@ -330,7 +330,7 @@ _newlist()
 	cur=`_get_cword`
 
 	if [[ "$cur" == -* ]]; then
-		COMPREPLY=( $( compgen -W '-l --language -q --quiet -h --help' -- $cur ) )
+		COMPREPLY=( $( compgen -W '-l --language -q --quiet -h --help' -- "$cur" ) )
 	else
 		_mailman_lists
 	fi
@@ -348,7 +348,7 @@ _rmlist()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '--archives -a \
-			-h --help' -- $cur ) )
+			-h --help' -- "$cur" ) )
 	else
 		_mailman_lists
 	fi
@@ -378,7 +378,7 @@ _config_list()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '--inputfile -i --outputfile -o \
-		--checkonly -c --verbose -v -h --help' -- $cur ) )
+		--checkonly -c --verbose -v -h --help' -- "$cur" ) )
 	else
 		_mailman_lists
 	fi
@@ -399,7 +399,7 @@ _arch()
 
 	case "$prev" in
 		-@(w|g|d|--welcome-msg|-goodbye-msg|-digest))
-			COMPREPLY=( $( compgen -W 'y n' -- $cur) )
+			COMPREPLY=( $( compgen -W 'y n' -- "$cur") )
 			return 0
 			;;
 		-@(d|-file))
@@ -412,7 +412,7 @@ _arch()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '--wipe -s --start -e --end \
-			-q --quiet -h --help' -- $cur ) )
+			-q --quiet -h --help' -- "$cur" ) )
 	else
 		args=$COMP_CWORD
 		for (( i=1; i < COMP_CWORD; i++ )); do
@@ -443,7 +443,7 @@ _cleanarch()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-s --status -n --dry-run \
-			-q --quiet -h --help' -- $cur ) )
+			-q --quiet -h --help' -- "$cur" ) )
 	fi
 
 } &&
@@ -471,7 +471,7 @@ _inject()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-l --listname -q --queue \
-			-h --help' -- $cur ) )
+			-h --help' -- "$cur" ) )
 	else
 		_filedir
 	fi
@@ -488,7 +488,7 @@ _dumpdb()
 	cur=`_get_cword`
 
 	if [[ "$cur" == -* ]]; then
-		COMPREPLY=( $( compgen -W '--marshal -m --pickle -p --noprint -n -h --help' -- $cur ) )
+		COMPREPLY=( $( compgen -W '--marshal -m --pickle -p --noprint -n -h --help' -- "$cur" ) )
 	else
 		_filedir
 	fi
@@ -506,7 +506,7 @@ _check_db()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '--all -a --verbose -v \
-			-h --help' -- $cur ) )
+			-h --help' -- "$cur" ) )
 	else
 		_mailman_lists
 	fi
@@ -523,7 +523,7 @@ _check_perms()
 	cur=`_get_cword`
 
 	if [[ "$cur" == -* ]]; then
-		COMPREPLY=( $( compgen -W '-f -v -h' -- $cur ) )
+		COMPREPLY=( $( compgen -W '-f -v -h' -- "$cur" ) )
 	fi
 
 } &&
@@ -538,7 +538,7 @@ _genaliases()
 	cur=`_get_cword`
 
 	if [[ "$cur" == -* ]]; then
-		COMPREPLY=( $( compgen -W '-q --quiet -h --help' -- $cur ) )
+		COMPREPLY=( $( compgen -W '-q --quiet -h --help' -- "$cur" ) )
 	fi
 
 } &&
@@ -553,7 +553,7 @@ _mmsitepass()
 	cur=`_get_cword`
 
 	if [[ "$cur" == -* ]]; then
-		COMPREPLY=( $( compgen -W '-c --listcreator -h --help' -- $cur ) )
+		COMPREPLY=( $( compgen -W '-c --listcreator -h --help' -- "$cur" ) )
 	fi
 
 } &&
@@ -572,7 +572,7 @@ _qrunner()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-r --runner --once -o \
-			-l --list -v --verbose -s --subproc -h --help' -- $cur ) )
+			-l --list -v --verbose -s --subproc -h --help' -- "$cur" ) )
 	fi
 
 } &&
@@ -588,9 +588,9 @@ _mailmanctl()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-n --no-restart -u --run-as-user \
-			-s --stale-lock-cleanup --quiet -q -h --help' -- $cur ) )
+			-s --stale-lock-cleanup --quiet -q -h --help' -- "$cur" ) )
 	else
-		COMPREPLY=( $( compgen -W 'start stop restart reopen' -- $cur ) )
+		COMPREPLY=( $( compgen -W 'start stop restart reopen' -- "$cur" ) )
 	fi
 
 } &&
diff --git a/contrib/make b/contrib/make
index d1c5ac0..14b0700 100644
--- a/contrib/make
+++ b/contrib/make
@@ -39,7 +39,7 @@ _make()
 			--silent --quiet --no-keep-goind --stop --touch \
 			--version --print-directory --no-print-directory \
 			--what-if --new-file --assume-new \
-			--warn-undefined-variables' -- $cur ) )
+			--warn-undefined-variables' -- "$cur" ) )
 	else
 		# before we check for makefiles, see if a path was specified
 		# with -C
@@ -67,7 +67,7 @@ _make()
 		COMPREPLY=( $( compgen -W "$( make -qp $makef $makef_dir 2>/dev/null | \
 					awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ \
 					{split($1,A,/ /);for(i in A)print A[i]}' )" \
-					-- $cur ) )
+					-- "$cur" ) )
 
 	fi
 } &&
diff --git a/contrib/man b/contrib/man
index 89bf877..06a773d 100644
--- a/contrib/man
+++ b/contrib/man
@@ -38,7 +38,7 @@ _man()
 	fi
 
 	if [ -z "$manpath" ]; then
-		COMPREPLY=( $( compgen -c -- $cur ) )
+		COMPREPLY=( $( compgen -c -- "$cur" ) )
 		return 0
 	fi
 
diff --git a/contrib/mc b/contrib/mc
index 96de7fb..c9e5714 100644
--- a/contrib/mc
+++ b/contrib/mc
@@ -37,7 +37,7 @@ _mc()
 			--datadir -k --resetsoft -l --ftplog -P --printwd \
 			-s --slow -t --termcap -u --nosubshell -U --subshell \
 			-v --view -V --version -x --xterm -D --debuglevel -h \
-			--help' -- $cur ) )
+			--help' -- "$cur" ) )
 	else
 		_filedir -d
 	fi
diff --git a/contrib/mcrypt b/contrib/mcrypt
index 9eb1226..2c5a60a 100644
--- a/contrib/mcrypt
+++ b/contrib/mcrypt
@@ -15,28 +15,28 @@ _mcrypt()
 	case "$prev" in
 		-@(g|-openpgp-z))
 			COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9' \
-				-- $cur ) )
+				-- "$cur" ) )
 			return 0
 			;;
 		-@(o|-keymode))
 			COMPREPLY=( $( compgen -W '$( mcrypt --list-keymodes \
-				2>/dev/null )' -- $cur ) )
+				2>/dev/null )' -- "$cur" ) )
 			return 0
 			;;
 		-@(m|-mode))
 			COMPREPLY=( $( compgen -W "$( mcrypt --list \
 				2>/dev/null | sed -e 's/.*: //' -e 's/ $//' | \
-				sort | uniq )" -- $cur ) )
+				sort | uniq )" -- "$cur" ) )
 			return 0
 			;;
 		-@(a|-algorithm))
 			COMPREPLY=( $( compgen -W "$( mcrypt --list \
-				2>/dev/null | awk '{print $1}' )" -- $cur ) )
+				2>/dev/null | awk '{print $1}' )" -- "$cur" ) )
 			return 0
 			;;
 		-@(h|-hash))
 			COMPREPLY=( $( compgen -W '$( mcrypt --list-hash \
-				2>/dev/null | sed -e 1d )' -- $cur ) )
+				2>/dev/null | sed -e 1d )' -- "$cur" ) )
 			return 0
 			;;
 		-@(k|s|-@(key?(size))))
@@ -61,7 +61,7 @@ _mcrypt()
 			--doublecheck -u --unlink --nodelete -t --time -F \
 			--force --echo -r --random --list --list-keymodes \
 			--list-hash -V --verbose -q --quiet --help -v \
-			--version -L --license' -- $cur ) )
+			--version -L --license' -- "$cur" ) )
 	elif [[ ${COMP_WORDS[0]} == mdecrypt ]]; then
 		_filedir '@(nc)'
 	else
diff --git a/contrib/mdadm b/contrib/mdadm
index d771952..5fa1811 100644
--- a/contrib/mdadm
+++ b/contrib/mdadm
@@ -23,10 +23,10 @@ _mdadm_raid_level()
 
 	case $mode in
 		create)
-			COMPREPLY=( $( compgen -W 'linear raid0 0 stripe raid1 1 mirror raid4 4 raid5 5 raid6 6 raid10 10 multipath mp faulty' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'linear raid0 0 stripe raid1 1 mirror raid4 4 raid5 5 raid6 6 raid10 10 multipath mp faulty' -- "$cur" ) )
 			;;
 		build)
-			COMPREPLY=( $( compgen -W 'linear stripe raid0 0 raid1 multipath mp faulty' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'linear stripe raid0 0 raid1 multipath mp faulty' -- "$cur" ) )
 			;;
 	esac
 }
@@ -43,10 +43,10 @@ _mdadm_raid_layout()
 
 	case $level in
 		raid5)
-			COMPREPLY=( $( compgen -W 'left-asymmetric left-symmetric right-asymmetric right-symmetric la ra ls rs' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'left-asymmetric left-symmetric right-asymmetric right-symmetric la ra ls rs' -- "$cur" ) )
 			;;
 		raid10)
-			COMPREPLY=( $( compgen -W 'n o p' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'n o p' -- "$cur" ) )
 			;;
 		faulty)
 			COMPREPLY=( $( compgen -W 'write-transient wt read-transient rt write-persistent wp read-persistent rp write-all read-fixable rf clear flush none' -- $cur ) )
@@ -56,12 +56,12 @@ _mdadm_raid_layout()
 
 _mdadm_auto_flag()
 {
-	COMPREPLY=( $( compgen -W 'no yes md mdp part p' -- $cur ) )
+	COMPREPLY=( $( compgen -W 'no yes md mdp part p' -- "$cur" ) )
 }
 
 _mdadm_update_flag()
 {
-	COMPREPLY=( $( compgen -W 'sparc2.2 summaries uuid name homehost resync byteorder super-minor' -- $cur ) )
+	COMPREPLY=( $( compgen -W 'sparc2.2 summaries uuid name homehost resync byteorder super-minor' -- "$cur" ) )
 }
 
 
@@ -129,24 +129,24 @@ _mdadm()
 
 	if [[ "$cur" == -* ]]; then
 		if [[ $COMP_CWORD -eq 1 ]] ; then
-			COMPREPLY=( $( compgen -W "$options -A --assemble -B --build -C --create -F --follow --monitor -G --grow" -- $cur ) )
+			COMPREPLY=( $( compgen -W "$options -A --assemble -B --build -C --create -F --follow --monitor -G --grow" -- "$cur" ) )
 		else
 			case ${COMP_WORDS[COMP_CWORD-1]} in
 				-@(A|-assemble))
-					COMPREPLY=( $( compgen -W "$options -u --uuid= -m --super-minor= -N --name= -f --force -R --run --no-degraded -a --auto -b --bitmap= --backup-file= -U --update= --auto-update-homehost" -- $cur ) )
+					COMPREPLY=( $( compgen -W "$options -u --uuid= -m --super-minor= -N --name= -f --force -R --run --no-degraded -a --auto -b --bitmap= --backup-file= -U --update= --auto-update-homehost" -- "$cur" ) )
 					;;
 				-@(B|C|G|-build|-create|-grow))
-					COMPREPLY=( $( compgen -W "$options -n --raid-devices= -x --spare-devices= -z --size= -c --chunk= --rounding= -l --level= -p --layout= --parity= -b --bitmap= --bitmap-chunk= -W --write-mostly --write-behind= --assume-clean --backup-file= -N --name= -R --run -f --force -a --auto" -- $cur ) )
+					COMPREPLY=( $( compgen -W "$options -n --raid-devices= -x --spare-devices= -z --size= -c --chunk= --rounding= -l --level= -p --layout= --parity= -b --bitmap= --bitmap-chunk= -W --write-mostly --write-behind= --assume-clean --backup-file= -N --name= -R --run -f --force -a --auto" -- "$cur" ) )
 					;;
 				-@(F|-follow|-monitor))
-					COMPREPLY=( $( compgen -W "$options -m --mail -p --program --alert -y --syslog -d --delay -f --daemonise -i --pid-file -1 --oneshot -t --test" -- $cur ) )
+					COMPREPLY=( $( compgen -W "$options -m --mail -p --program --alert -y --syslog -d --delay -f --daemonise -i --pid-file -1 --oneshot -t --test" -- "$cur" ) )
 
 					;;
 				@(/dev/*|--add|--fail|--remove))
-					COMPREPLY=( $( compgen -W "$options -a --add --re-add -r --remove -f --fail --set-faulty" -- $cur ) )
+					COMPREPLY=( $( compgen -W "$options -a --add --re-add -r --remove -f --fail --set-faulty" -- "$cur" ) )
 					;;
 				*)
-					COMPREPLY=( $( compgen -W "$options -Q --query -D --detail -E --examine --sparc2.2 -X --examine-bitmap -R --run -S --stop -o --readonly -w --readwrite --zero-superblock -t --test" -- $cur ) )
+					COMPREPLY=( $( compgen -W "$options -Q --query -D --detail -E --examine --sparc2.2 -X --examine-bitmap -R --run -S --stop -o --readonly -w --readwrite --zero-superblock -t --test" -- "$cur" ) )
 					;;
 			esac
 		fi
diff --git a/contrib/minicom b/contrib/minicom
index dcc4b5f..2e3f7d9 100644
--- a/contrib/minicom
+++ b/contrib/minicom
@@ -14,7 +14,7 @@ _minicom()
 
 	case $prev in
 		-@(a|c))
-			COMPREPLY=( $( compgen -W 'on off' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
 			return 0
 			;;
 		-@(S|C))
@@ -23,7 +23,7 @@ _minicom()
 			;;
 		-P)
 			COMPREPLY=( $( command ls /dev/tty* ) )
-			COMPREPLY=( $( compgen -W '${COMPREPLY[@]} ${COMPREPLY[@]#/dev/}' -- $cur ) )
+			COMPREPLY=( $( compgen -W '${COMPREPLY[@]} ${COMPREPLY[@]#/dev/}' -- "$cur" ) )
 			return 0
 			;;
 	esac
@@ -31,14 +31,14 @@ _minicom()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-s -o -m -M -z -l -L -w -a -t \
-			-c -S -d -p -C -T -7 -8' -- $cur ) )
+			-c -S -d -p -C -T -7 -8' -- "$cur" ) )
 		return 0
 	else
 		[ -n "$( command ls /etc/minirc.* 2>/dev/null)" ] && confdir=/etc
 		[ -n "$( command ls /etc/minicom/minirc.* 2>/dev/null)" ] && confdir=/etc/minicom
 		if [ -n "$confdir" ]; then
 			COMPREPLY=( $( compgen -W '$( command ls $confdir/minirc.* | \
-				sed -e "s|$confdir/minirc.||")' -- $cur ) )
+				sed -e "s|$confdir/minirc.||")' -- "$cur" ) )
 			return 0
 		fi
 	fi
diff --git a/contrib/mkinitrd b/contrib/mkinitrd
index 5125115..b72c71d 100644
--- a/contrib/mkinitrd
+++ b/contrib/mkinitrd
@@ -37,7 +37,7 @@ _mkinitrd()
 			--omit-ide-modules --image-version --force-raid-probe \
 			--omit-raid-modules --with --force-lvm-probe \
 			--omit-lvm-modules --builtin --omit-dmraid --net-dev \
-			--fstab --nocompress --dsdt --bootchart' -- $cur ) )
+			--fstab --nocompress --dsdt --bootchart' -- "$cur" ) )
 	else
 		_count_args
 
diff --git a/contrib/mock b/contrib/mock
index f7fc7bc..dad43d2 100644
--- a/contrib/mock
+++ b/contrib/mock
@@ -50,11 +50,11 @@ _mock()
 			# (e.g. ix86 chroot builds in x86_64 mock host)
 			# This would actually depend on what the target root
 			# can be used to build for...
-			COMPREPLY=( $( compgen -W "$( command rpm --showrc | sed -ne 's/^\s*compatible\s\+archs\s*:\s*\(.*\)/\1/i p' )" -- $cur ) )
+			COMPREPLY=( $( compgen -W "$( command rpm --showrc | sed -ne 's/^\s*compatible\s\+archs\s*:\s*\(.*\)/\1/i p' )" -- "$cur" ) )
 			return 0
 			;;
 		--@(en|dis)able-plugin)
-			COMPREPLY=( $( compgen -W "$plugins" -- $cur ) )
+			COMPREPLY=( $( compgen -W "$plugins" -- "$cur" ) )
 			return 0
 			;;
 	esac
@@ -71,7 +71,7 @@ _mock()
 			--configdir --rpmbuild_timeout --unpriv --cwd --spec \
 			--sources -v --verbose -q --quiet --trace \
 			--enable-plugin --disable-plugin --print-root-path' \
-			-- $cur ) )
+			-- "$cur" ) )
 	else
 		_filedir '?(no)src.rpm'
 	fi
diff --git a/contrib/modules b/contrib/modules
index cd267d3..58ad68c 100644
--- a/contrib/modules
+++ b/contrib/modules
@@ -57,26 +57,26 @@ _module () {
       options="$( module help 2>&1 | egrep '^[[:space:]]*\+' | \
 		  awk '{print $2}' | sed -e 's/|/ /g' | sort )"
 
-      COMPREPLY=( $(compgen -W "$options" -- $cur) )
+      COMPREPLY=( $(compgen -W "$options" -- "$cur") )
 
    elif [ $COMP_CWORD -eq 2 ] ; then
 
       case "$prev" in
       @(add|display|help|load|show|whatis))
-          COMPREPLY=( $(_module_avail $cur) )
+          COMPREPLY=( $(_module_avail "$cur") )
           ;;
 
       @(rm|switch|swap|unload|update))
-          COMPREPLY=( $(_module_list $cur) )
+          COMPREPLY=( $(_module_list "$cur") )
           ;;
       unuse)
-          COMPREPLY=( $(_module_path $cur) )
+          COMPREPLY=( $(_module_path "$cur") )
          ;;
       esac
    elif [ $COMP_CWORD -eq 3 ] ; then
       case ${COMP_WORDS[1]} in
          @(sw?(ap|itch)))
-            COMPREPLY=( $(_module_avail $cur) )
+            COMPREPLY=( $(_module_avail "$cur") )
             ;;
       esac
    fi
diff --git a/contrib/mplayer b/contrib/mplayer
index c4ca9e0..65dbd73 100644
--- a/contrib/mplayer
+++ b/contrib/mplayer
@@ -9,7 +9,7 @@ _mplayer_options_list()
 	cur=${cur%\\}
 	COMPREPLY=( $( compgen -W "$( $1 $2 help 2>/dev/null | \
 		sed -e '1,/^Available/d' | awk '{print $1}' | \
-		sed -e 's/:$//' -e 's/^'${2#-}'$//' -e 's/<.*//' )" -- $cur ) )
+		sed -e 's/:$//' -e 's/^'${2#-}'$//' -e 's/<.*//' )" -- "$cur" ) )
 }
 
 _mplayer()
@@ -108,7 +108,7 @@ _mplayer()
 			;;
 		-lavdopts)
 			COMPREPLY=( $( compgen -W 'ec er= bug= idct= gray' \
-					-- $cur ) )
+					-- "$cur" ) )
 			return 0
 			;;
 		-lavcopts)
@@ -128,22 +128,22 @@ _mplayer()
 					format= pred qpel precmp= cmp= \
 					subcmp= predia= dia= trell last_pred= \
 					preme= subq= psnr mpeg_quant aic umv' \
-					-- $cur ) )
+					-- "$cur" ) )
 			return 0
 			;;
 		-ssf)
 			COMPREPLY=( $( compgen -W 'lgb= cgb= ls= cs= chs= \
-					cvs=' -- $cur ) )
+					cvs=' -- "$cur" ) )
 			return 0
 			;;
 		-jpeg)
 			COMPREPLY=( $( compgen -W 'noprogressive progressive \
 					nobaseline baseline optimize= \
-					smooth= quality= outdir=' -- $cur ) )
+					smooth= quality= outdir=' -- "$cur" ) )
 			return 0
 			;;
 		-xvidopts)
-			COMPREPLY=( $( compgen -W 'dr2 nodr2' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'dr2 nodr2' -- "$cur" ) )
 			return 0
 			;;
 		-xvidencopts)
@@ -155,7 +155,7 @@ _mplayer()
 					max_key_interval= mpeg_quant \
 					mod_quant lumi_mask hintedme \
 					hintfile debug keyframe_boost= \
-					kfthreshold= kfreduction=' -- $cur ) )
+					kfthreshold= kfreduction=' -- "$cur" ) )
 			return 0
 			;;
 		-divx4opts)
@@ -163,35 +163,35 @@ _mplayer()
 					min_quant= max_quant= rc_period= \
 					rc_reaction_period= crispness= \
 					rc_reaction_ratio= pass= vbrpass= \
-					help' -- $cur ) )
+					help' -- "$cur" ) )
 			return 0
 			;;
 		-info)
 			COMPREPLY=( $( compgen -W 'name= artist= genre= \
 					subject= copyright= srcform= \
-					comment= help' -- $cur ) )
+					comment= help' -- "$cur" ) )
 			return 0
 			;;
 		-lameopts)
 			COMPREPLY=( $( compgen -W 'vbr= abr cbr br= q= aq= \
 					ratio= vol= mode= padding= fast \
-					preset= help' -- $cur ) )
+					preset= help' -- "$cur" ) )
 			return 0
 			;;
 		-rawaudio)
 			COMPREPLY=( $( compgen -W 'on channels= rate= \
-					samplesize= format=' -- $cur ) )
+					samplesize= format=' -- "$cur" ) )
 			return 0
 			;;
 		-rawvideo)
 			COMPREPLY=( $( compgen -W 'on fps= sqcif qcif cif \
 					4cif pal ntsc w= h= y420 yv12 yuy2 \
-					y8 format= size=' -- $cur ) )
+					y8 format= size=' -- "$cur" ) )
 			return 0
 			;;
 		-aop)
 			COMPREPLY=( $( compgen -W 'list= delay= format= fout= \
-					volume= mul= softclip' -- $cur ) )
+					volume= mul= softclip' -- "$cur" ) )
 			return 0
 			;;
 		-dxr2)
@@ -204,7 +204,7 @@ _mplayer()
 					ck-bmax= ck-r= ck-g= ck-b= \
 					ignore-cache= ol-osd= olh-cor= \
 					olw-cor= olx-cor= oly-cor= overlay \
-					overlay-ratio= update-cache' -- $cur ))
+					overlay-ratio= update-cache' -- "$cur" ))
 			return 0
 			;;
 		-tv)
@@ -214,24 +214,24 @@ _mplayer()
 					audiorate= forceaudio alsa amode= \
 					forcechan= adevice= audioid= volume= \
 					bass= treble= balance= fps= \
-					channels= immediatemode=' -- $cur ) )
+					channels= immediatemode=' -- "$cur" ) )
 			return 0
 			;;
 		-mf)
 			COMPREPLY=( $( compgen -W 'on w= h= fps= type=' \
-					-- $cur ) )
+					-- "$cur" ) )
 			return 0
 			;;
 		-cdda)
 			COMPREPLY=( $( compgen -W 'speed= paranoia= \
 					generic-dev= sector-size= overlap= \
 					toc-bias toc-offset= skip noskip' \
-					-- $cur ) )
+					-- "$cur" ) )
 			return 0
 			;;
 		-input)
 			COMPREPLY=( $( compgen -W 'conf= ar-delay ar-rate \
-					keylist cmdlist js-dev file' -- $cur ) )
+					keylist cmdlist js-dev file' -- "$cur" ) )
 			return 0
 			;;
 		-af)
@@ -239,11 +239,11 @@ _mplayer()
 					channels channels= format format= \
 					volume volume= delay delay= pan \
 					pan= sub sub= surround surround=' \
-					-- $cur ) )
+					-- "$cur" ) )
 			return 0
 			;;
 		-af-adv)
-			COMPREPLY=( $( compgen -W 'force= list=' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'force= list=' -- "$cur" ) )
 			return 0
 			;;
 	esac
@@ -253,7 +253,7 @@ _mplayer()
 			COMPREPLY=( $( compgen -W '$( $cmd -list-options 2>/dev/null | \
 			sed -ne '1,/^[[:space:]]*Name/d' \
 			     -e "s/^[[:space:]]*/-/" -e "s/[[:space:]:].*//" \
-			     -e "/^-\(Total\|.*\*\)\?$/!p" )' -- $cur ) )
+			     -e "/^-\(Total\|.*\*\)\?$/!p" )' -- "$cur" ) )
 			;;
 		*)
 			_filedir '@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|avi|AVI|asf|ASF|vob|VOB|bin|BIN|dat|DAT|vcd|VCD|ps|PS|pes|PES|fl[iv]|FL[IV]|viv|VIV|rm?(j)|RM?(J)|ra?(m)|RA?(M)|yuv|YUV|mov|MOV|qt|QT|mp[234]|MP[234]|m4[av]|M4[AV]|og[gmavx]|OG[GMAVX]|w?(a)v|W?(A)V|dump|DUMP|mk[av]|MK[AV]|m4a|M4A|aac|AAC|m[24]v|M[24]V|dv|DV|rmvb|RMVB|mid|MID|ts|TS|3g[p2]|mpc|MPC|flac|FLAC|vro|VRO|divx|DIVX|aif?(f)|AIF?(F)|m2ts|M2TS|vdr|VDR|xvid|XVID|ape|APE)'
diff --git a/contrib/msynctool b/contrib/msynctool
index 281cafd..b536862 100644
--- a/contrib/msynctool
+++ b/contrib/msynctool
@@ -19,12 +19,12 @@ _msynctool()
 		--configure)
 			COMPREPLY=( $( compgen -W "$(msynctool --showgroup \
 				$prev | awk '/^Member/ {print $2}' | sed \
-				-e 's/:$//' )" -- $cur ) )
+				-e 's/:$//' )" -- "$cur" ) )
 			return 0
 			;;
 		--addmember)
 			COMPREPLY=( $( compgen -W '$(msynctool --listplugins \
-				| sed -e '1d' )' -- $cur ) )
+				| sed -e '1d' )' -- "$cur" ) )
 			return 0
 			;;
 	esac
@@ -32,12 +32,12 @@ _msynctool()
 	case $prev in
 		--@(configure|@(add|del|show)group|sync|addmember))
 			COMPREPLY=( $( compgen -W '$(msynctool --listgroups \
-				| sed -e '1d' )' -- $cur ) )
+				| sed -e '1d' )' -- "$cur" ) )
 			return 0
 			;;
 		--@(showformats|filter-objtype|slow-sync))
 			COMPREPLY=( $( compgen -W '$(msynctool --listobjects \
-				| sed -e '1d' )' -- $cur ) )
+				| sed -e '1d' )' -- "$cur" ) )
 			return 0
 			;;
 	esac
@@ -45,6 +45,6 @@ _msynctool()
 	COMPREPLY=( $( compgen -W '--listgroups --listplugins --listobjects \
 		--showformats --showgroup --sync --filter-objtype --slow-sync \
 		--wait --multi --addgroup --delgroup --addmember --configure \
-		--manual --configdir --conflict' -- $cur ) )
+		--manual --configdir --conflict' -- "$cur" ) )
 } &&
 complete -F _msynctool msynctool
diff --git a/contrib/mtx b/contrib/mtx
index 7d5f2cc..39cc634 100644
--- a/contrib/mtx
+++ b/contrib/mtx
@@ -27,10 +27,10 @@ _mtx()
     if [ $COMP_CWORD -gt 1 ]; then
 	case $prev in
 	    load)
-		COMPREPLY=( $( compgen -W "$tapes" -- $cur ) )
+		COMPREPLY=( $( compgen -W "$tapes" -- "$cur" ) )
 		;;
 	    unload|first|last|next)
-		COMPREPLY=( $( compgen -W "$drives" -- $cur ) )
+		COMPREPLY=( $( compgen -W "$drives" -- "$cur" ) )
 		;;
 	    -f)
 		true
@@ -40,7 +40,7 @@ _mtx()
 		;;
 	esac
     else
-        COMPREPLY=( $( compgen -W "$options" -- $cur ) )
+        COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
     fi
     return 0
 } &&
diff --git a/contrib/munin-node b/contrib/munin-node
index 6599df9..746ed27 100644
--- a/contrib/munin-node
+++ b/contrib/munin-node
@@ -25,10 +25,10 @@ _munin-run()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '--config --servicedir --sconfdir \
-			--sconffile --help --debug --version' -- $cur ) )
+			--sconffile --help --debug --version' -- "$cur" ) )
 	else
 		COMPREPLY=( $( compgen -W '$( command ls /etc/munin/plugins )' \
-			-- $cur ) )
+			-- "$cur" ) )
 	fi
 } &&
 complete -F _munin-run munin-run
@@ -57,7 +57,7 @@ _munin-update()
 		COMPREPLY=( $( compgen -W '--force-root --[no]force-root \
 			--service --host --config --help --debug --nodebug \
 			--fork --nofork --stdout --nostdout --timeout' \
-			-- $cur ) )
+			-- "$cur" ) )
 	fi
 } &&
 complete -F _munin-update munin-update
@@ -85,7 +85,7 @@ _munin-node-configure()
 			return 0
 			;;
 		--snmpversion)
-			COMPREPLY=( $( compgen -W '1 2c 3' -- $cur ) )
+			COMPREPLY=( $( compgen -W '1 2c 3' -- "$cur" ) )
 			return 0
 			;;
 	esac
@@ -94,7 +94,7 @@ _munin-node-configure()
 		COMPREPLY=( $( compgen -W '--help --version --debug --config \
 			--servicedir --libdir --families --suggest --shell \
 			--remove-also --snmp --snmpversion --snmpcommunity' \
-			-- $cur ) )
+			-- "$cur" ) )
 	fi
 } &&
 complete -F _munin-node-configure munin-node-configure
diff --git a/contrib/mutt b/contrib/mutt
index 2145f5d..dd0b8ea 100644
--- a/contrib/mutt
+++ b/contrib/mutt
@@ -12,7 +12,7 @@ _muttaddr()
 	_muttquery
 
 	cur=`_get_cword`
-	COMPREPLY=( "${COMPREPLY[@]}" $( compgen -u -- $cur ) )
+	COMPREPLY=( "${COMPREPLY[@]}" $( compgen -u -- "$cur" ) )
 
 	return 0
 }
@@ -50,7 +50,7 @@ _muttaliases()
 	conffiles=( $(eval _muttconffiles $muttrc $muttrc) )
 	aliases=( $( sed -rn 's|^alias[[:space:]]+([^[:space:]]+).*$|\1|p' \
 			$(eval echo "${conffiles[@]}") ) )
-	COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "${aliases[*]}" -- $cur ) )
+	COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "${aliases[*]}" -- "$cur" ) )
 
 	return 0
 }
@@ -70,7 +70,7 @@ _muttquery()
 	fi
 
 	COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "${queryresults[*]}" \
-			-- $cur ) )
+			-- "$cur" ) )
 
 	return 0
 }
@@ -112,7 +112,7 @@ _mutt()
 	-*)
 		COMPREPLY=( $( compgen -W '-A -a -b -c -e -f -F -H -i -m -n \
 					    -p -Q -R -s -v -x -y -z -Z -h' \
-					    -- $cur ) )
+					    -- "$cur" ) )
 		return 0
 		;;
 	*)
diff --git a/contrib/mysqladmin b/contrib/mysqladmin
index 49c7a46..dc177a0 100644
--- a/contrib/mysqladmin
+++ b/contrib/mysqladmin
@@ -14,7 +14,7 @@ _mysqladmin()
 
 	case "$prev" in
 	-u)
-		COMPREPLY=( $( compgen -u -- $cur ) )
+		COMPREPLY=( $( compgen -u -- "$cur" ) )
 		return 0
 		;;
 	*)
@@ -22,7 +22,7 @@ _mysqladmin()
 	esac
 
 	COMPREPLY=( $( compgen -W '-# -f -? -C -h -p -P -i -r -E -s -S -t -u \
-					      -v -V -w' -- $cur ) )
+					      -v -V -w' -- "$cur" ) )
 
 	COMPREPLY=( "${COMPREPLY[@]}" \
 		    $( compgen -W 'create drop extended-status flush-hosts \
@@ -30,6 +30,6 @@ _mysqladmin()
 				   flush-threads flush-privileges kill \
 				   password ping processlist reload refresh \
 				   shutdown status variables version' \
-		       -- $cur ) )
+		       -- "$cur" ) )
 } &&
 complete -F _mysqladmin mysqladmin
diff --git a/contrib/ncftp b/contrib/ncftp
index 5431451..441e0f6 100644
--- a/contrib/ncftp
+++ b/contrib/ncftp
@@ -13,7 +13,7 @@ _ncftp()
 
 	if [ $COMP_CWORD -eq 1 ] && [ -f ~/.ncftp/bookmarks ]; then
 	    COMPREPLY=( $( compgen -W '$( sed -ne "s/^\([^,]\{1,\}\),.*$/\1/p" \
-			   ~/.ncftp/bookmarks )' -- $cur ) )
+			   ~/.ncftp/bookmarks )' -- "$cur" ) )
 	fi
 
 	return 0
diff --git a/contrib/net-tools b/contrib/net-tools
index a443bd2..088a208 100644
--- a/contrib/net-tools
+++ b/contrib/net-tools
@@ -17,12 +17,12 @@ _mii_tool()
 	case $prev in
 		-F|--force)
 			COMPREPLY=( $( compgen -W '100baseTx-FD 100baseTx-HD \
-				10baseT-FD 10baseT-HD' -- $cur ) )
+				10baseT-FD 10baseT-HD' -- "$cur" ) )
 			return 0
 			;;
 		-A|--advertise)
 			COMPREPLY=( $( compgen -W '100baseT4 100baseTx-FD 100baseTx-HD \
-				10baseT-FD 10baseT-HD' -- $cur ) )
+				10baseT-FD 10baseT-HD' -- "$cur" ) )
 			return 0
 			;;
 	esac
@@ -32,7 +32,7 @@ _mii_tool()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-v --verbose -V --version -R \
 			--reset -r --restart -w  --watch -l --log -A \
-			--advertise -F --force' -- $cur ) )
+			--advertise -F --force' -- "$cur" ) )
 	else
 		_available_interfaces -a
 	fi
@@ -54,7 +54,7 @@ _mii_diag()
 		-@(F|A|-advertise|-fixed-speed))
 			COMPREPLY=( $( compgen -W '100baseT4 100baseTx \
 				100baseTx-FD 100baseTx-HD 10baseT 10baseT-FD \
-				10baseT-HD' -- $cur ) )
+				10baseT-HD' -- "$cur" ) )
 				return 0
 			;;
 	esac
@@ -66,7 +66,7 @@ _mii_diag()
 			--all-interfaces -s --status -D --debug -g \
 			--read-parameters -G --set-parameters -M  --msg-level \
 			-p --phy -r  --restart -R  --reset -v -V -w --watch \
-			-? --help' -- $cur ) )
+			-? --help' -- "$cur" ) )
 	else
 		_available_interfaces -a
 	fi
@@ -91,7 +91,7 @@ _route()
 
 	COMPREPLY=( $( compgen -W 'add del -host -net netmask metric mss \
 				   window irtt reject mod dyn reinstate dev \
-				   default gw' -- $cur ) )
+				   default gw' -- "$cur" ) )
 
 	COMPREPLY=( $( echo " ${COMP_WORDS[@]}" | \
 		       (while read -d ' ' i; do
diff --git a/contrib/ntpdate b/contrib/ntpdate
index f717f58..5f8964f 100644
--- a/contrib/ntpdate
+++ b/contrib/ntpdate
@@ -18,14 +18,14 @@ _ntpdate()
 			return 0
 			;;
 		-U)
-			COMPREPLY=( $( compgen -u $cur  ) )
+			COMPREPLY=( $( compgen -u "$cur"  ) )
 			return 0
 			;;
 	esac
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-4 -6 -b -B -d -Q -q -s -u -v -a\
-			-e -k -p -o -r -t' -- $cur ) )
+			-e -k -p -o -r -t' -- "$cur" ) )
 	else
 		_known_hosts_real "$cur"
 	fi
diff --git a/contrib/openldap b/contrib/openldap
index 5a63a24..daf3b1c 100644
--- a/contrib/openldap
+++ b/contrib/openldap
@@ -6,12 +6,12 @@
 have ldapsearch && {
 _ldap_uris()
 {
-	COMPREPLY=( $( compgen -W 'ldap:// ldaps://' -- $cur ) )
+	COMPREPLY=( $( compgen -W 'ldap:// ldaps://' -- "$cur" ) )
 }
 
 _ldap_protocols()
 {
-	COMPREPLY=( $( compgen -W '2 3' -- $cur ) )
+	COMPREPLY=( $( compgen -W '2 3' -- "$cur" ) )
 }
 
 _ldapsearch()
@@ -41,12 +41,12 @@ _ldapsearch()
 			;;
 		-s)
 			COMPREPLY=( $( compgen -W 'base one sub children' \
-				-- $cur ) )
+				-- "$cur" ) )
 			return 0
 			;;
 		-a)
 			COMPREPLY=( $( compgen -W 'never always search find' \
-				-- $cur ) )
+				-- "$cur" ) )
 			return 0
 			;;
 		-P)
@@ -58,7 +58,7 @@ _ldapsearch()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-n -u -v -t -tt -T -F -A -C -L -LL \
 			-LLL -M -MM -S -d -f -x -D -W -w -y -H -h -p -b -s -a \
-			-P -e -E -l -z -O -I -Q -U -R -X -Y -Z -ZZ' -- $cur ) )
+			-P -e -E -l -z -O -I -Q -U -R -X -Y -Z -ZZ' -- "$cur" ) )
 	fi
 }
 complete -F _ldapsearch ldapsearch
@@ -96,7 +96,7 @@ _ldapaddmodify()
 		if [[ ${COMP_WORDS[0]} == ldapmodify ]]; then
 			options="$options -a"
 		fi
-		COMPREPLY=( $( compgen -W "$options" -- $cur ) )
+		COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
 	fi
 }
 complete -F _ldapaddmodify ldapadd ldapmodify
@@ -131,7 +131,7 @@ _ldapdelete()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-n -v -c -M -MM -d -f -D -W -w -y \
 			-H -h -P -p -O -U -R -r -x -I -Q -X -Y -Z -ZZ' \
-			-- $cur ) )
+			-- "$cur" ) )
 	fi
 }
 complete -F _ldapdelete ldapdelete
@@ -166,7 +166,7 @@ _ldapcompare()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-n -v -z -M -MM -d -D -W -w -y \
 			-H -h -P -p -O -I -Q -U -R -x -X -Y -Z -ZZ' \
-			-- $cur ) )
+			-- "$cur" ) )
 	fi
 }
 complete -F _ldapcompare ldapcompare
@@ -201,7 +201,7 @@ _ldapmodrdn()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-r -s -n -v -c -M -MM -d -D -W -w \
 			-y -H -h -P -p -O -I -Q -U -R -x -X -Y -Z -ZZ -f' \
-			-- $cur ) )
+			-- "$cur" ) )
 	fi
 }
 complete -F _ldapmodrdn ldapmodrdn
@@ -235,7 +235,7 @@ _ldapwhoami()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-n -v -z -d -D -W -w -y -H -h -p -P \
-			-O -I -Q -U -R -x -X -Y -Z -ZZ' -- $cur ) )
+			-O -I -Q -U -R -x -X -Y -Z -ZZ' -- "$cur" ) )
 	fi
 }
 complete -F _ldapwhoami ldapwhoami
@@ -265,7 +265,7 @@ _ldappasswd()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-A -a -t -d -D -H -h -n -p -S -s -T \
-			-v -W -w -y -O -I -Q -U -R -x -X -Y -Z -ZZ' -- $cur ) )
+			-v -W -w -y -O -I -Q -U -R -x -X -Y -Z -ZZ' -- "$cur" ) )
 	fi
 }
 complete -F _ldappasswd ldappasswd
diff --git a/contrib/openssl b/contrib/openssl
index db46592..9c924b8 100644
--- a/contrib/openssl
+++ b/contrib/openssl
@@ -27,7 +27,7 @@ _openssl_sections()
 	[ ! -f "$config" ] && return 0
 
 	COMPREPLY=( $( compgen -W "$( awk '/\[.*\]/ {print $2}' $config )" \
-		-- $cur ) )
+		-- "$cur" ) )
 }
 
 _openssl()
@@ -53,7 +53,7 @@ _openssl()
 		rc4-40'
 
 	if [ $COMP_CWORD -eq 1 ]; then
-		COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
+		COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) )
 	else
 		command=${COMP_WORDS[1]}
 		prev=${COMP_WORDS[COMP_CWORD-1]}
@@ -80,7 +80,7 @@ _openssl()
 						formats="$formats SMIME"
 						;;
 				esac
-				COMPREPLY=( $( compgen -W "$formats" -- $cur ) )
+				COMPREPLY=( $( compgen -W "$formats" -- "$cur" ) )
 				return 0
 				;;
 			-connect)
@@ -89,12 +89,12 @@ _openssl()
 				;;
 			-starttls)
 				COMPREPLY=( $( compgen -W 'smtp pop3 imap ftp' \
-					-- $cur ) )
+					-- "$cur" ) )
 				return 0
 				;;
 			-cipher)
 				COMPREPLY=( $( compgen -W "$(openssl ciphers | \
-					tr ':' '\n')" -- $cur ) )
+					tr ':' '\n')" -- "$cur" ) )
 				return 0
 				;;
 		esac
@@ -278,7 +278,7 @@ _openssl()
 					options='-c -d'
 					;;
 			esac
-			COMPREPLY=( $( compgen -W "$options" -- $cur ) )
+			COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
 		else
 			if [[ "$command" == speed ]]; then
 				COMPREPLY=( $( compgen -W 'md2 mdc2 md5 hmac \
@@ -286,7 +286,7 @@ _openssl()
 					bf-cbc des-cbc des-ede3 rc4 rsa512 \
 					rsa1024 rsa2048 rsa4096 dsa512 dsa1024 \
 					dsa2048 idea rc2 des rsa blowfish' -- \
-					$cur ) )
+					"$cur" ) )
 			else
 				_filedir
 			fi
diff --git a/contrib/p4 b/contrib/p4
index 002c6b7..45e446a 100644
--- a/contrib/p4
+++ b/contrib/p4
@@ -19,16 +19,16 @@ _p4()
 		text binary resource"
 
 	if [ $COMP_CWORD -eq 1 ]; then
-		COMPREPLY=( $( compgen -W "$p4commands" -- $cur ) )
+		COMPREPLY=( $( compgen -W "$p4commands" -- "$cur" ) )
 	elif [ $COMP_CWORD -eq 2 ]; then
 		case "$prev" in
 		help)
 			COMPREPLY=( $( compgen -W "simple commands \
 				environment filetypes jobview revisions \
-				usage views $p4commands" -- $cur ) )
+				usage views $p4commands" -- "$cur" ) )
 			;;
 		admin)
-			COMPREPLY=( $( compgen -W "checkpoint stop" -- $cur ) )
+			COMPREPLY=( $( compgen -W "checkpoint stop" -- "$cur" ) )
 			;;
 		*)
 			;;
@@ -40,7 +40,7 @@ _p4()
 			case "$prev2" in
 			add|edit|reopen)
 				COMPREPLY=( $( compgen -W "$p4filetypes" \
-					       -- $cur) )
+					       -- "$cur") )
 				;;
 			*)
 				;;
diff --git a/contrib/perl b/contrib/perl
index d9a5674..e826201 100644
--- a/contrib/perl
+++ b/contrib/perl
@@ -7,7 +7,7 @@ have perl &&
 {
 _perlmodules()
 {
-    COMPREPLY=( $( compgen -P "$prefix" -W "$( perl -e 'sub mods { my ($base,$dir)=@_; return if  $base !~ /^\Q$ENV{cur}/; chdir($dir) or return; for (glob(q[*.pm])) {s/\.pm$//; print qq[$base$_\n]}; mods(/^(?:[.\d]+|$Config{archname}-$Config{osname}|auto)$/ ? undef : qq[${base}${_}\\\\:\\\\:],qq[$dir/$_]) for grep {-d} glob(q[*]); } mods(undef,$_) for @INC;' )" -- $cur ) )
+    COMPREPLY=( $( compgen -P "$prefix" -W "$( perl -e 'sub mods { my ($base,$dir)=@_; return if  $base !~ /^\Q$ENV{cur}/; chdir($dir) or return; for (glob(q[*.pm])) {s/\.pm$//; print qq[$base$_\n]}; mods(/^(?:[.\d]+|$Config{archname}-$Config{osname}|auto)$/ ? undef : qq[${base}${_}\\\\:\\\\:],qq[$dir/$_]) for grep {-d} glob(q[*]); } mods(undef,$_) for @INC;' )" -- "$cur" ) )
 }
 
 _perl()
@@ -45,7 +45,7 @@ _perl()
 
     if [[ "$cur" == -* ]]; then
 	    COMPREPLY=( $( compgen -W '-C -s -T -u -U -W -X -h -v -V -c -w -d \
-		    -D -p -n -a -F -l -0 -I -m -M -P -S -x -i -e ' -- $cur ) )
+		    -D -p -n -a -F -l -0 -I -m -M -P -S -x -i -e ' -- "$cur" ) )
     else
 	_filedir
     fi
@@ -100,18 +100,18 @@ _perldoc()
 	    getnetbyaddr getnetbyname getnetent getprotobyname \
 	    getprotobynumber getprotoent getservbyname getservbyport \
 	    getservent sethostent setnetent setprotoent setservent \
-	    gmtime localtime time times' -- $cur ) )
+	    gmtime localtime time times' -- "$cur" ) )
 	    return 0
 	    ;;
     esac
 
     if [[ "$cur" == -* ]]; then
-	    COMPREPLY=( $( compgen -W '-h -v -t -u -m -l -F -X -f -q' -- $cur ))
+	    COMPREPLY=( $( compgen -W '-h -v -t -u -m -l -F -X -f -q' -- "$cur" ))
     else
 	    # return available modules (unless it is clearly a file)
 	    if [[ "$cur" != */* ]]; then
 		    _perlmodules
-		    COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W '$( PAGER=/bin/cat man perl |  sed -ne "/perl.*Perl overview/,/perlwin32/p" | awk "\$NF=2 { print \$1}" | grep perl )' -- $cur ) )
+		    COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W '$( PAGER=/bin/cat man perl |  sed -ne "/perl.*Perl overview/,/perlwin32/p" | awk "\$NF=2 { print \$1}" | grep perl )' -- "$cur" ) )
 	    fi
     fi
 }
diff --git a/contrib/pine b/contrib/pine
index 6453062..05c029b 100644
--- a/contrib/pine
+++ b/contrib/pine
@@ -12,6 +12,6 @@ _pineaddr()
 	cur=`_get_cword`
 
 	COMPREPLY=( $( compgen -W '$( awk "{print \$1}" ~/.addressbook 2>/dev/null)' \
-			-- $cur ) )
+			-- "$cur" ) )
 } &&
 complete -F _pineaddr $default pine
diff --git a/contrib/pkg-config b/contrib/pkg-config
index 8d96031..23c5e30 100644
--- a/contrib/pkg-config
+++ b/contrib/pkg-config
@@ -38,10 +38,10 @@ _pkg_config()
 			--exact-version --max-version --list-all --debug \
 			--print-errors --silence-errors --errors-to-stdout \
 			--print-provides --print-requires -? --help --usage' \
-			-- $cur) )
+			-- "$cur") )
 	else
 		COMPREPLY=( $( compgen -W "$( pkg-config --list-all \
-				2>/dev/null | awk '{print $1}' )" -- $cur ) )
+				2>/dev/null | awk '{print $1}' )" -- "$cur" ) )
 	fi
 } &&
 complete -F _pkg_config pkg-config
diff --git a/contrib/pkg_install b/contrib/pkg_install
index 48a372c..eb8bb19 100644
--- a/contrib/pkg_install
+++ b/contrib/pkg_install
@@ -16,7 +16,7 @@ _pkg_delete()
 
 	[ "$prev" = "-o" -o "$prev" = "-p" -o "$prev" = "-W" ] && return 0
 
-	COMPREPLY=( $( compgen -d $pkgdir$cur ) )
+	COMPREPLY=( $( compgen -d "$pkgdir$cur" ) )
 	COMPREPLY=( ${COMPREPLY[@]#$pkgdir} )
 
 	return 0
diff --git a/contrib/portupgrade b/contrib/portupgrade
index 339523f..8ee5cda 100644
--- a/contrib/portupgrade
+++ b/contrib/portupgrade
@@ -14,7 +14,7 @@ _portupgrade()
 
 	[ "$prev" = "-l" -o "$prev" = "-L" -o "$prev" = "-o" ] && return 0
 
-	COMPREPLY=( $( compgen -d $pkgdir$cur ) )
+	COMPREPLY=( $( compgen -d "$pkgdir$cur" ) )
 	COMPREPLY=( ${COMPREPLY[@]#$pkgdir} )
 	COMPREPLY=( ${COMPREPLY[@]%-*} )
 
diff --git a/contrib/postfix b/contrib/postfix
index be0d5ab..5bc9c42 100644
--- a/contrib/postfix
+++ b/contrib/postfix
@@ -20,18 +20,18 @@ _postfix()
 			return 0
 			;;
 		-D)
-			COMPREPLY=( $( compgen -W 'start' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'start' -- "$cur" ) )
 			return 0
 			;;
 	esac
 
 	if [[ $cur == -* ]]; then
-		COMPREPLY=( $( compgen -W '-c -D -v' -- $cur ) )
+		COMPREPLY=( $( compgen -W '-c -D -v' -- "$cur" ) )
 		return 0
 	fi
 
 	COMPREPLY=( $( compgen -W 'check start stop abort flush reload status \
-		set-permissions upgrade-configuration' -- $cur ) )
+		set-permissions upgrade-configuration' -- "$cur" ) )
 }
 complete -F _postfix $filenames postfix
 
@@ -57,12 +57,12 @@ _postmap()
 
 	if [[ $cur == -* ]]; then
 		COMPREPLY=( $( compgen -W '-N -f -i -n -o -p -r -v -w -c -d -q'\
-			-- $cur ) )
+			-- "$cur" ) )
 		return 0
 	fi
 
 	if [[ "$cur" == *:* ]]; then
-	       	COMPREPLY=( $( compgen -f -- ${cur#*:} ) )
+	       	COMPREPLY=( $( compgen -f -- "${cur#*:}" ) )
 	else
 		len=${#cur}
 		idx=0
@@ -98,7 +98,7 @@ _postcat()
 	esac
 
 	if [[ $cur == -* ]]; then
-		COMPREPLY=( $( compgen -W '-c -q -v' -- $cur ) )
+		COMPREPLY=( $( compgen -W '-c -q -v' -- "$cur" ) )
 		return 0
 	fi
 
@@ -151,7 +151,7 @@ _postconf()
 
 	if [[ $cur == -* ]]; then
 		COMPREPLY=( $( compgen -W '-A -a -b -c -d -e -h -m -l -n -t -v'\
-			-- $cur ) )
+			-- "$cur" ) )
 		return 0
 	fi
 
@@ -221,11 +221,11 @@ _postsuper()
 	esac
 
 	if [[ $cur == -* ]]; then
-		COMPREPLY=( $( compgen -W '-c -d -h -H -p -r -s -v' -- $cur ) )
+		COMPREPLY=( $( compgen -W '-c -d -h -H -p -r -s -v' -- "$cur" ) )
 		return 0
 	fi
 
-	COMPREPLY=( $( compgen -W 'hold incoming active deferred' -- $cur ) )
+	COMPREPLY=( $( compgen -W 'hold incoming active deferred' -- "$cur" ) )
 }
 complete -F _postsuper $filenames postsuper
 }
diff --git a/contrib/postgresql b/contrib/postgresql
index e3b8574..a86312c 100644
--- a/contrib/postgresql
+++ b/contrib/postgresql
@@ -9,7 +9,7 @@ _pg_databases()
 	return # See https://launchpad.net/bugs/164772
 	COMPREPLY=( $( compgen -W "$( psql -l 2>/dev/null | \
 			sed -e '1,/^-/d' -e '/^(/,$d' | \
-			awk '{print $1}' )" -- $cur ) )
+			awk '{print $1}' )" -- "$cur" ) )
 }
 
 _pg_users()
@@ -18,7 +18,7 @@ _pg_users()
 	#COMPREPLY=( $( psql -qtc 'select usename from pg_user' template1 2>/dev/null | \
 	#		grep "^ $cur" ) )
 	#[ ${#COMPREPLY[@]} -eq 0 ] && COMPREPLY=( $( compgen -u -- $cur ) )
-	COMPREPLY=( $( compgen -u -- $cur ) )
+	COMPREPLY=( $( compgen -u -- "$cur" ) )
 }
 
 # createdb(1) completion
@@ -58,7 +58,7 @@ _createdb()
 		COMPREPLY=( $( compgen -W '-D -T -E -h -p -U -W -e -q \
 			--tablespace --template --encoding --host --port \
 			--username --password --echo --quiet --help --version' \
-			-- $cur ))
+			-- "$cur" ))
 	else
 		_pg_databases
 	fi
@@ -97,7 +97,7 @@ _dropdb()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-h -p -U -W -i -e -q \
 			--host --port --username --password --interactive \
-			--echo --quiet --help --version' -- $cur ) )
+			--echo --quiet --help --version' -- "$cur" ) )
 	else
 		_pg_databases
 	fi
@@ -157,7 +157,7 @@ _psql()
 			-S --single-line -t --tuples-only -T --table-attr \
 			-U --username -v --set --variable -V --version \
 			-W --password -x --expanded -X --no-psqlrc \
-			-1 --single-transaction -? --help' -- $cur ) )
+			-1 --single-transaction -? --help' -- "$cur" ) )
 	else
 		# return list of available databases
 		_pg_databases
diff --git a/contrib/python b/contrib/python
index 1a84196..97b4f8e 100644
--- a/contrib/python
+++ b/contrib/python
@@ -14,11 +14,11 @@ _python()
 
 	case "$prev" in
 	-Q)
-		COMPREPLY=( $( compgen -W "old new warn warnall" -- $cur ) )
+		COMPREPLY=( $( compgen -W "old new warn warnall" -- "$cur" ) )
 		return 0
 		;;
 	-W)
-		COMPREPLY=( $( compgen -W "ignore default all module once error" -- $cur ) )
+		COMPREPLY=( $( compgen -W "ignore default all module once error" -- "$cur" ) )
 		return 0
 		;;
 	-c)
@@ -43,7 +43,7 @@ _python()
 		_filedir '@(py|pyc|pyo)'
 	else
 		COMPREPLY=( $( compgen -W "- -d -E -h -i -O -Q -S -t -u \
-					   -U -v -V -W -x -c" -- $cur ) )
+					   -U -v -V -W -x -c" -- "$cur" ) )
 	fi
 
 
diff --git a/contrib/qemu b/contrib/qemu
index 39d5f8e..10509ce 100644
--- a/contrib/qemu
+++ b/contrib/qemu
@@ -22,83 +22,83 @@ _qemu()
 			return 0
 			;;
 		-boot)
-			COMPREPLY=( $( compgen -W 'a c d n' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'a c d n' -- "$cur" ) )
 			return 0
 			;;
 		-k)
 			COMPREPLY=( $( compgen -W 'ar de-ch es fo fr-ca hu ja \
 				mk no pt-br sv da en-gb et fr fr-ch is lt nl pl\
 				ru th de en-us fi fr-be hr it lv nl-be pt sl \
-				tr' -- $cur ) )
+				tr' -- "$cur" ) )
 			return 0
 			;;
 		-soundhw)
 			COMPREPLY=( $( compgen -W "$( qemu -soundhw ? | awk \
-				'/^[[:lower:]]/ {print $1}' ) all" -- $cur ) )
+				'/^[[:lower:]]/ {print $1}' ) all" -- "$cur" ) )
 			return 0
 			;;
 		-M)
 			COMPREPLY=( $( compgen -W "$( qemu -M ? | awk \
-				'/^[[:lower:]]/ {print $1}' )" -- $cur ) )
+				'/^[[:lower:]]/ {print $1}' )" -- "$cur" ) )
 			return 0
 			;;
 		-cpu)
 			COMPREPLY=( $( compgen -W "$( qemu -cpu ? | awk \
-				'{print $2}' )" -- $cur ) )
+				'{print $2}' )" -- "$cur" ) )
 			return 0
 			;;
 		-usbdevice)
 			COMPREPLY=( $( compgen -W 'mouse tablet disk: host: \
-				serial: braille net' -- $cur ) )
+				serial: braille net' -- "$cur" ) )
 			return 0
 			;;
 		-net)
 			COMPREPLY=( $( compgen -W 'nic user tap socket vde none dump' \
-				-- $cur ) )
+				-- "$cur" ) )
 			return 0
 			;;
 		-@(serial|parallel|monitor))
 			COMPREPLY=( $( compgen -W 'vc pty none null /dev/ \
 				file: stdio pipe: COM udp: tcp: telnet: unix: \
-				mon: braille' -- $cur ) )
+				mon: braille' -- "$cur" ) )
 			return 0
 			;;
 		-redir)
-			COMPREPLY=( $( compgen -S":" -W 'tcp udp' -- $cur ) )
+			COMPREPLY=( $( compgen -S":" -W 'tcp udp' -- "$cur" ) )
 			return 0
 			;;
 		-bt)
-			COMPREPLY=( $( compgen -W 'hci vhci device' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'hci vhci device' -- "$cur" ) )
 			return 0
 			;;
 		-vga)
-			COMPREPLY=( $( compgen -W 'cirrus std vmware xenfb none' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'cirrus std vmware xenfb none' -- "$cur" ) )
 			return 0
 			;;
 		-drive)
 			COMPREPLY=( $( compgen -S"=" -W 'file if bus unit index media \
-				cyls snapshot cache format serial addr' -- $cur	) )
+				cyls snapshot cache format serial addr' -- "$cur" ) )
 			return 0
 			;;
 		-ballon)
-			COMPREPLY=( $( compgen -W 'none virtio' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'none virtio' -- "$cur" ) )
 			return 0
 			;;
 		-smbios)
-			COMPREPLY=( $( compgen -W 'file type' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'file type' -- "$cur" ) )
 			return 0
 			;;
 		-watchdog)
-			COMPREPLY=( $( compgen -W "$( qemu -watchdog ? 2>&1 | awk '{print $1}' )" -- $cur ) )
+			COMPREPLY=( $( compgen -W "$( qemu -watchdog ? 2>&1 | awk '{print $1}' )" -- "$cur" ) )
 			return 0
 			;;
 		-watchdog-action)
 			COMPREPLY=( $( compgen -W 'reset shutdown poweroff pause \
-			debug none' -- $cur ) )
+			debug none' -- "$cur" ) )
 			return 0
 			;;
 		-runas)
-			COMPREPLY=( $( compgen -u -- $cur ) )
+			COMPREPLY=( $( compgen -u -- "$cur" ) )
 			return 0
 			;;
 	esac
@@ -118,7 +118,7 @@ _qemu()
 		-balloon -acpitable -smbios -singlestep -gdb -hdachs -bios \
 		-kernel-kqemu -enable-kqemu -enable-kvm -clock -watchdog \
 		-watchdog-action -virtioconsole -show-cursor -tb-size -incoming \
-		-chroot -runas' -- $cur ) )
+		-chroot -runas' -- "$cur" ) )
 	else
 		_filedir
 	fi
diff --git a/contrib/quota-tools b/contrib/quota-tools
index d3eb273..86f79ec 100644
--- a/contrib/quota-tools
+++ b/contrib/quota-tools
@@ -11,18 +11,18 @@ _user_or_group()
 	# complete on groups if -g was given
 	for (( i=1; i < COMP_CWORD; i++ )); do
 		if [[ "${COMP_WORDS[i]}" == -g ]]; then
-			COMPREPLY=( $( compgen -g -- $cur ) )
+			COMPREPLY=( $( compgen -g -- "$cur" ) )
 			return 0
 		fi
 	done
 
 	# otherwise complete on users
-	COMPREPLY=( $( compgen -u -- $cur ) )
+	COMPREPLY=( $( compgen -u -- "$cur" ) )
 }
 
 _quota_formats()
 {
-	COMPREPLY=( $( compgen -W 'vfsold vfsv0 rpc xfs' -- $cur ) )
+	COMPREPLY=( $( compgen -W 'vfsold vfsv0 rpc xfs' -- "$cur" ) )
 }
 
 _filesystems()
@@ -30,7 +30,7 @@ _filesystems()
 	#  Only list filesystems starting with "/", otherwise we also get
 	#+ "binfmt_misc", "proc", "tmpfs", ...
 	COMPREPLY=( $( compgen -W "$(awk '/^\// {print $1}' /etc/mtab)" \
-		-- $cur ) )
+		-- "$cur" ) )
 }
 
 _quota()
@@ -56,7 +56,7 @@ _quota()
 		COMPREPLY=( $( compgen -W '-F --format -g --group -u --user -v --verbose \
 			-s --human-readable -p --raw-grace -i --no-autofs -l --local-only \
 			-A --all-nfs -m --no-mixed-pathnames -q --quiet -Q --quiet-refuse \
-			-w --no-wrap' -- $cur ) )
+			-w --no-wrap' -- "$cur" ) )
 	else
 		_user_or_group
 	fi
@@ -85,7 +85,7 @@ _setquota()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-r --remote -m --no-mixed-pathnames \
 			-F --format -g --group -u --user -p --prototype -b --batch \
-			-c --continue-batch -t --edit-period -T --edit-times -a --all' -- $cur ) )
+			-c --continue-batch -t --edit-period -T --edit-times -a --all' -- "$cur" ) )
 	else
 		_count_args
 
@@ -128,7 +128,7 @@ _edquota()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-r --remote -m --no-mixed-pathnames \
 			-g --group -u --user -p --prototype -F --format -f --filesystem \
-			-t --edit-period -T --edit-times' -- $cur ) )
+			-t --edit-period -T --edit-times' -- "$cur" ) )
 	else
 		_user_or_group
 	fi
@@ -159,7 +159,7 @@ _quotacheck()
 			-g --group -u --user -c --create-files -f --force -i \
 			--interactive -n --use-first-dquot -M --try-remount -m \
 			--no-remount -R --exclude-root -F --format -a --all' \
-			-- $cur ) )
+			-- "$cur" ) )
 	else
 		_filesystems
 	fi
@@ -189,7 +189,7 @@ _repquota()
 		COMPREPLY=( $( compgen -W '-a --all -v --verbose -s --human-readable \
 			-c --batch-translation -C --no-batch-translation -t \
 			--truncate-names -n --no-names -p --raw-grace -i --no-autofs \
-			-u --user -g --group -F --format' -- $cur ) )
+			-u --user -g --group -F --format' -- "$cur" ) )
 	else
 		_filesystems
 	fi
@@ -217,7 +217,7 @@ _quotaon()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-a --all -v --verbose -u --user \
-			-g --group -f --off -p --print-state -F --format' -- $cur ) )
+			-g --group -f --off -p --print-state -F --format' -- "$cur" ) )
 	else
 		_filesystems
 	fi
@@ -240,7 +240,7 @@ _quotaoff()
 			return 0
 			;;
 		-@(x|-xfs-command))
-			COMPREPLY=( $( compgen -W 'delete enforce' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'delete enforce' -- "$cur" ) )
 			return 0
 			;;
 	esac
@@ -250,7 +250,7 @@ _quotaoff()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-a --all -v --verbose -u --user \
 			-g --group -p --print-state -x --xfs-command -F --format' \
-			-- $cur ) )
+			-- "$cur" ) )
 	else
 		_filesystems
 	fi
diff --git a/contrib/rdesktop b/contrib/rdesktop
index 1656ff1..729ef01 100644
--- a/contrib/rdesktop
+++ b/contrib/rdesktop
@@ -21,11 +21,11 @@ _rdesktop()
 				$HOME/.rdesktop/keymaps 2>/dev/null ) )
 			COMPREPLY=( ${COMPREPLY[@]:-} $( command ls \
 				./keymaps 2>/dev/null ) )
-			COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- $cur ) )
+			COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
 			return 0
 			;;
 		-a)
-			COMPREPLY=( $( compgen -W '8 15 16 24' -- $cur ) )
+			COMPREPLY=( $( compgen -W '8 15 16 24' -- "$cur" ) )
 			return 0
 			;;
 		-x)
@@ -36,7 +36,7 @@ _rdesktop()
 		-r)
 			# FIXME: should do $nospace for the colon options
 			COMPREPLY=( $( compgen -W 'comport: disk: lptport: \
-				printer: sound: lspci scard' -- $cur ) )
+				printer: sound: lspci scard' -- "$cur" ) )
 			return 0
 			;;
 	esac
@@ -44,7 +44,7 @@ _rdesktop()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-u -d -s -c -p -n -k -g -f -b -L \
 			-A -B -e -E -m -C -D -K -S -T -N -X -a -z -x -P -r \
-			-0 -4 -5' -- $cur ) )
+			-0 -4 -5' -- "$cur" ) )
 	else
 		_known_hosts_real "$cur"
 	fi
diff --git a/contrib/repomanage b/contrib/repomanage
index d932496..566b389 100644
--- a/contrib/repomanage
+++ b/contrib/repomanage
@@ -16,7 +16,7 @@ _repomanage()
 
 	if [[ "$cur" == -* ]] ; then
 		COMPREPLY=( $( compgen -W '-o --old -n --new -s --space -k \
-				--keep -c --nocheck -h --help' -- $cur ) )
+				--keep -c --nocheck -h --help' -- "$cur" ) )
 	else
 		_filedir -d
 	fi
diff --git a/contrib/reportbug b/contrib/reportbug
index fa962ff..e3d9ae0 100644
--- a/contrib/reportbug
+++ b/contrib/reportbug
@@ -19,30 +19,30 @@ _reportbug()
 		;;
 	    -B|--bts)
 		COMPREPLY=( $( compgen -W "debian guug kde mandrake help" -- \
-			       $cur ))
+			       "$cur" ))
 		return 0
 		;;
 	    -e|--editor|--mua)
-		COMP_WORDS=(COMP_WORDS[0] $cur)
+		COMP_WORDS=(COMP_WORDS[0] "$cur")
 		COMP_CWORD=1
 		_command
 		return 0
 		;;
 	    --mode)
-		COMPREPLY=( $( compgen -W "novice standard expert" -- $cur ) )
+		COMPREPLY=( $( compgen -W "novice standard expert" -- "$cur" ) )
 		return 0
 		;;
 	    -S|--severity)
 		COMPREPLY=( $( compgen -W "grave serious important normal \
-					   minor wishlist" -- $cur ) )
+					   minor wishlist" -- "$cur" ) )
 		return 0
 		;;
 	    -u|--ui|--interface)
-		COMPREPLY=( $( compgen -W "newt text gnome" -- $cur ) )
+		COMPREPLY=( $( compgen -W "newt text gnome" -- "$cur" ) )
 		return 0
 		;;
 	    -t|--type)
-		COMPREPLY=( $( compgen -W "gnats debbugs" -- $cur ) )
+		COMPREPLY=( $( compgen -W "gnats debbugs" -- "$cur" ) )
 		return 0
 		;;
 	    -T|--tags)
@@ -51,7 +51,7 @@ _reportbug()
 					   lenny lenny-ignore sid experimental confirmed \
 					   d-i fixed fixed-in-experimental fixed-upstream \
 					   help l10n moreinfo patch pending security \
-					   unreproducible upstream wontfix ipv6 lfs" -- $cur ))
+					   unreproducible upstream wontfix ipv6 lfs" -- "$cur" ))
 		return 0
 		;;
 	    *)
@@ -76,8 +76,8 @@ _reportbug()
 			listarchives lists.debian.org mirrors nm.debian.org \
 			press project qa.debian.org release-notes \
 			security.debian.org tech-ctte upgrade-reports \
-			www.debian.org' -- $cur ) \
-	    		$( apt-cache pkgnames -- $cur 2> /dev/null) )
+			www.debian.org' -- "$cur" ) \
+	    		$( apt-cache pkgnames -- "$cur" 2> /dev/null) )
 	_filedir
 	return 0
 } &&
@@ -97,11 +97,11 @@ _querybts()
 	case "$prev" in
 	    -B|--bts)
 		COMPREPLY=( $( compgen -W "debian guug kde mandrake help" -- \
-			       $cur ))
+			       "$cur" ))
 		return 0
 		;;
 	    -u|--ui|--interface)
-		COMPREPLY=($( compgen -W "newt text gnome" -- $cur ))
+		COMPREPLY=($( compgen -W "newt text gnome" -- "$cur" ))
 		return 0
 		;;
 	esac
@@ -116,7 +116,7 @@ _querybts()
 			listarchives lists.debian.org mirrors nm.debian.org \
 			press project qa.debian.org release-notes \
 			security.debian.org tech-ctte upgrade-reports \
-			www.debian.org' -- $cur ) \
-	    		$( apt-cache pkgnames -- $cur 2> /dev/null) )
+			www.debian.org' -- "$cur" ) \
+	    		$( apt-cache pkgnames -- "$cur" 2> /dev/null) )
 } &&
 complete -F _querybts $filenames querybts
diff --git a/contrib/resolvconf b/contrib/resolvconf
index 8264d76..ea0b02f 100644
--- a/contrib/resolvconf
+++ b/contrib/resolvconf
@@ -20,7 +20,7 @@ _resolvconf()
 	esac
 	
 	if [[ "$cur" == -* ]]; then
-		COMPREPLY=( $( compgen -W '-a -d -u' -- $cur ) )
+		COMPREPLY=( $( compgen -W '-a -d -u' -- "$cur" ) )
 	fi
 } &&
 complete -F _resolvconf resolvconf
diff --git a/contrib/rfkill b/contrib/rfkill
index d1ca395..ca802fa 100644
--- a/contrib/rfkill
+++ b/contrib/rfkill
@@ -12,12 +12,12 @@ _rfkill()
 	cur=`_get_cword`
 	
 	if [[ "$cur" == -* ]]; then
-		COMPREPLY=( $( compgen -W '--version' -- $cur ) )
+		COMPREPLY=( $( compgen -W '--version' -- "$cur" ) )
 	else
 		case $COMP_CWORD in
 			1)
 				COMPREPLY=( $( compgen -W "help event list \
-					block unblock" -- $cur ) )
+					block unblock" -- "$cur" ) )
 				;;
 			2)
 				prev=${COMP_WORDS[COMP_CWORD-1]}
@@ -26,7 +26,7 @@ _rfkill()
 						"$(rfkill list | awk -F: \
 						'/^[0-9]/ {print $1}') \
 						all wifi bluetooth uwb wimax \
-						wwan gps" -- $cur ) )
+						wwan gps" -- "$cur" ) )
 				fi
 				;;
 		esac
diff --git a/contrib/ri b/contrib/ri
index cfe3f35..80ee6e5 100644
--- a/contrib/ri
+++ b/contrib/ri
@@ -1,32 +1,4 @@
-# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
-# ex: ts=8 sw=8 noet filetype=sh
-#
-# ri completion for Ruby documentation by Ian Macdonald <ian at caliban.org>
-
-have ri && {
-ri_get_methods()
-{
-	local regex
-
-	if [ "$ri_version" = integrated ]; then
-	  if [ -z "$separator" ]; then
-	    regex="(Instance|Class)"
-	  elif [ "$separator" = "#" ]; then
-	    regex=Instance
-	  else
-	    regex=Class
-	  fi
-
-	  COMPREPLY=( ${COMPREPLY[@]} \
-	    "$( ri ${classes[@]} 2>/dev/null | \
-	      ruby -ane 'if /^'"$regex"' methods:/.../^------------------|^$/ and \
-	      /^ / then print $_.split(/, |,$/).grep(/^[^\[]*$/).join("\n"); \
-	      end' | sort -u )" )
-	else
-	  # older versions of ri didn't distinguish between class/module and
-	  # instance methods
-	  COMPREPLY=( ${COMPREPLY[@]} \
-	    "$( ruby -W0 $ri_path ${classes[@]} | ruby -ane 'if /^-/.../^-/ and \
+_path ${classes[@]} | ruby -ane 'if /^-/.../^-/ and \
 	      ! /^-/ and ! /^ +(class|module): / then \
 	      print $_.split(/, |,$| +/).grep(/^[^\[]*$/).join("\n"); \
 	      end' | sort -u )" )
@@ -77,7 +49,7 @@ _ri()
 				 if /^ .*[A-Z]/ then print; end; end' ))
 	fi
 
-	COMPREPLY=( $( compgen -W '${classes[@]}' -- $cur ) )
+	COMPREPLY=( $( compgen -W '${classes[@]}' -- "$cur" ) )
 	if [[ "$cur" == [A-Z]* ]]; then
 	  # we're completing on class or module alone
 	  return 0
diff --git a/contrib/rpcdebug b/contrib/rpcdebug
index 6c2dd53..4fb1f87 100644
--- a/contrib/rpcdebug
+++ b/contrib/rpcdebug
@@ -18,7 +18,7 @@ _rpcdebug_flags()
 	if [ -n "$module" ]; then
 		COMPREPLY=( $( compgen -W "$(rpcdebug -vh 2>&1 \
 			| grep '^'$module' '\
-			| awk '{$1 = ""; print $0}')" -- $cur ) )
+			| awk '{$1 = ""; print $0}')" -- "$cur" ) )
 	fi
 }
 
@@ -40,13 +40,13 @@ _rpcdebug()
 			return 0
 			;;
 		-m)
-			COMPREPLY=( $( compgen -W 'rpc nfs nfsd nlm' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'rpc nfs nfsd nlm' -- "$cur" ) )
 			return 0
 			;;
 	esac
 
 	if [[ "$cur" == -* ]]; then
-		COMPREPLY=( $( compgen -W '-v -h -m -s -c' -- $cur ) )
+		COMPREPLY=( $( compgen -W '-v -h -m -s -c' -- "$cur" ) )
 	fi
 }
 complete -F _rpcdebug rpcdebug
diff --git a/contrib/rpm b/contrib/rpm
index 1e480dd..a100a5e 100644
--- a/contrib/rpm
+++ b/contrib/rpm
@@ -26,7 +26,7 @@ _rpm_groups()
 	# http://lists.alioth.debian.org/pipermail/bash-completion-devel/2009-May/001486.html
 	local IFS=$'\n'
 	COMPREPLY=( $( compgen -W "$( rpm -qa $nodig $nosig --queryformat \
-		'%{group}\n' )" -- $cur ) )
+		'%{group}\n' )" -- "$cur" ) )
 }
 
 _rpm_nodigsig()
@@ -64,11 +64,11 @@ _rpm()
 		case "$cur" in
 		-b*)
 			COMPREPLY=( $( compgen -W '-ba -bb -bc -bi -bl -bp -bs'\
-				       -- $cur ) )
+				       -- "$cur" ) )
 			;;
 		-t*)
 			COMPREPLY=( $( compgen -W '-ta -tb -tc -ti -tl -tp -ts'\
-				       -- $cur ) )
+				       -- "$cur" ) )
 			;;
 		--*)
 			COMPREPLY=( $( compgen -W '--help --version --initdb \
@@ -76,11 +76,11 @@ _rpm()
 			--rebuilddb --showrc --setperms --setugids --tarbuild \
 			--eval --install --upgrade --query --freshen --erase \
 			--verify --querytags --rmsource --rmspec --clean \
-			--import' -- $cur ) )
+			--import' -- "$cur" ) )
 			;;
 		*)
 			COMPREPLY=( $( compgen -W '-b -e -E -F -i -q -t -U -V' \
-				       -- $cur ) )
+				       -- "$cur" ) )
 			;;
 		esac
 
@@ -100,7 +100,7 @@ _rpm()
 		return 0
 		;;
 	--pipe)
-		COMPREPLY=( $( compgen -c -- $cur ) )
+		COMPREPLY=( $( compgen -c -- "$cur" ) )
 		return 0
 		;;
 	--rcfile)
@@ -120,7 +120,7 @@ _rpm()
 			local IFS=$'\n'
 			COMPREPLY=( $( compgen -W "$( rpm -qa $nodig $nosig \
 					--queryformat='%{providename}\n' )" \
-					-- $cur ) )
+					-- "$cur" ) )
 		fi
 		return 0
 		;;
@@ -132,13 +132,13 @@ _rpm()
 			local IFS=$'\n'
 			COMPREPLY=( $( compgen -W "$( rpm -qa $nodig $nosig \
 					--queryformat='%{requirename}\n' )" \
-					-- $cur ) )
+					-- "$cur" ) )
 		fi
 		return 0
 		;;
 	--target)
 		COMPREPLY=( $( compgen -W "$( command rpm --showrc | sed -ne \
-		's/^\s*compatible\s\+build\s\+archs\s*:\s*\(.*\)/\1/ p' )" -- $cur ) )
+		's/^\s*compatible\s\+build\s\+archs\s*:\s*\(.*\)/\1/ p' )" -- "$cur" ) )
 		return 0
 		;;
 	esac
@@ -154,7 +154,7 @@ _rpm()
 			--noorder --relocate --badreloc --notriggers \
 			--excludepath --ignoresize --oldpackage --define \
 			--eval --pipe --queryformat --repackage --nosuggests \
-			--nodigest --nosignature' -- $cur ) )
+			--nodigest --nosignature' -- "$cur" ) )
 		else
 			_filedir 'rpm'
 		fi
@@ -162,7 +162,7 @@ _rpm()
 	-@(e|-erase))
 		if [[ "$cur" == -* ]]; then
 			COMPREPLY=( $( compgen -W '--allmatches --noscripts \
-			--notriggers --nodeps --test --repackage' -- $cur ) )
+			--notriggers --nodeps --test --repackage' -- "$cur" ) )
 		else
 			_rpm_installed_packages "$nodig" "$nosig"
 		fi
@@ -181,7 +181,7 @@ _rpm()
 				--conflicts --obsoletes \
 				--nodigest --nosignature \
 				--suggests --enhances \
-				--triggerscripts' -- $cur ) )
+				--triggerscripts' -- "$cur" ) )
 		    else
 			_filedir
 		    fi
@@ -198,7 +198,7 @@ _rpm()
 				--define --eval --pipe --showrc --info --list \
 				--state --docfiles --configfiles --queryformat\
 				--conflicts --obsoletes --nodigest \
-				--nosignature' -- $cur ) )
+				--nosignature' -- "$cur" ) )
 			else
 				_filedir 'rpm'
 			fi
@@ -215,7 +215,7 @@ _rpm()
 				--docfiles --configfiles --queryformat \
 				--conflicts --obsoletes --pkgid --hdrid \
 				--fileid --tid --nodigest --nosignature \
-				--triggerscripts' -- $cur ) )
+				--triggerscripts' -- "$cur" ) )
 			elif [ "${COMP_LINE#* -*([^ -])a}" == "$COMP_LINE" ]; then
 				_rpm_installed_packages "$nodig" "$nosig"
 			fi
@@ -224,7 +224,7 @@ _rpm()
 	-@(K*|-checksig))
 		if [[ "$cur" == -* ]]; then
 			COMPREPLY=( $( compgen -W '--nopgp --nogpg --nomd5 \
-					--nodigest --nosignature' -- $cur ) )
+					--nodigest --nosignature' -- "$cur" ) )
 		else
 			_filedir 'rpm'
 		fi
@@ -235,7 +235,7 @@ _rpm()
 			--nodeps --nogroup --nolinkto --nomode --nomtime \
 			--nordev --nouser --nofiles --noscripts --nomd5 \
 			--querytags --specfile --whatrequires --whatprovides \
-			--nodigest --nosignature' -- $cur ) )
+			--nodigest --nosignature' -- "$cur" ) )
 		# check whether we're doing file completion
 		elif [ "${COMP_LINE#* -*([^ -])f}" != "$COMP_LINE" ]; then
 			_filedir
@@ -251,7 +251,7 @@ _rpm()
 		if [[ "$cur" == -* ]]; then
 			COMPREPLY=( $( compgen -W '--short-circuit --timecheck \
 			--clean --rmsource --rmspec --test --sign --buildroot \
-			--target --nobuild --nodeps --nodirtokens' -- $cur ) )
+			--target --nobuild --nodeps --nodirtokens' -- "$cur" ) )
 		elif [[ ${COMP_WORDS[1]} == -b* ]]; then
 			_filedir 'spec'
 		else
@@ -261,7 +261,7 @@ _rpm()
 	--re@(build|compile))
 		if [[ "$cur" == -* ]]; then
 			COMPREPLY=( $( compgen -W '--nodeps --rmsource \
-			  --rmspec --sign --nodirtokens --target' -- $cur ) )
+			  --rmspec --sign --nodirtokens --target' -- "$cur" ) )
 		else
 			_filedir '?(no)src.rpm'
 		fi
@@ -278,7 +278,7 @@ _rpm()
 	--@(clean|rms@(ource|pec)))
 		if [[ "$cur" == -* ]]; then
 			COMPREPLY=( $( compgen -W '--clean --rmsource \
-					--rmspec' -- $cur ) )
+					--rmspec' -- "$cur" ) )
 		else
 			_filedir 'spec'
 		fi
@@ -286,7 +286,7 @@ _rpm()
 	--@(import|dbpath|root))
 		if [[ "$cur" == -* ]]; then
 			COMPREPLY=( $( compgen -W '--import --dbpath --root' \
-					-- $cur ) )
+					-- "$cur" ) )
 		else
 			_filedir
 		fi
diff --git a/contrib/rpmcheck b/contrib/rpmcheck
index c27592b..1cf69db 100644
--- a/contrib/rpmcheck
+++ b/contrib/rpmcheck
@@ -22,7 +22,7 @@ _rpmcheck()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-explain -failures -successes \
 			-dump -dump-all -base -help -compressed-input' \
-			-- $cur ) )
+			-- "$cur" ) )
 	else
 		_filedir
 	fi
diff --git a/contrib/rrdtool b/contrib/rrdtool
index 40e2cbf..693dde9 100644
--- a/contrib/rrdtool
+++ b/contrib/rrdtool
@@ -9,6 +9,6 @@ _rrdtool ()
 	cur=`_get_cword`
 	COMPREPLY=( $( compgen -W 'create update updatev graph dump \
 	                           restore last lastupdate first info \
-	                           fetch tune resize xport' -- $cur ) )
+	                           fetch tune resize xport' -- "$cur" ) )
 } &&
 complete -F _rrdtool rrdtool
diff --git a/contrib/rsync b/contrib/rsync
index 86ce634..a7349c5 100644
--- a/contrib/rsync
+++ b/contrib/rsync
@@ -26,7 +26,7 @@ _rsync()
 		return 0
 		;;
 	-@(e|-rsh))
-		COMPREPLY=( $( compgen -W 'rsh ssh' -- $cur ) )
+		COMPREPLY=( $( compgen -W 'rsh ssh' -- "$cur" ) )
 		return 0
 		;;
 	esac
@@ -54,7 +54,7 @@ _rsync()
 				--address= --config= --port= --blocking-io \
 				--no-blocking-io --stats --progress \
 				--log-format= --password-file= --bwlimit= \
-				--write-batch= --read-batch= --help' -- $cur ))
+				--write-batch= --read-batch= --help' -- "$cur" ))
 		;;
 	*:*)
 		# find which remote shell is used
diff --git a/contrib/samba b/contrib/samba
index 714019a..f3529e5 100644
--- a/contrib/samba
+++ b/contrib/samba
@@ -6,13 +6,13 @@
 have smbclient && {
 _samba_resolve_order()
 {
-	COMPREPLY=( $( compgen -W 'lmhosts host wins bcast' -- $cur ) )
+	COMPREPLY=( $( compgen -W 'lmhosts host wins bcast' -- "$cur" ) )
 }
 
 _samba_domains()
 {
 	if [ -n "${COMP_SAMBA_SCAN:-}" ]; then
-		COMPREPLY=( $( compgen -W '$( smbtree -N -D )' -- $cur ) )
+		COMPREPLY=( $( compgen -W '$( smbtree -N -D )' -- "$cur" ) )
 	fi
 }
 
@@ -27,7 +27,7 @@ _samba_hosts()
 
 _samba_debuglevel()
 {
-	COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9 10' -- $cur ) )
+	COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9 10' -- "$cur" ) )
 }
 
 _smbclient()
@@ -47,7 +47,7 @@ _smbclient()
 			;;
 		-t)
 			COMPREPLY=( $( compgen -W 'SJIS EUC JIS7 JIS8 JUNET \
-				HEX CAP' -- $cur ) )
+				HEX CAP' -- "$cur" ) )
 			return 0;
 			;;
 		-s|-A|--authentication-file)
@@ -62,12 +62,12 @@ _smbclient()
 			COMPREPLY=( $( compgen -W 'SO_KEEPALIVE SO_REUSEADDR \
 				SO_BROADCAST TCP_NODELAY IPTOS_LOWDELAY \
 				IPTOS_THROUGHPUT SO_SNDBUF SO_RCVBUF \
-				SO_SNDLOWAT SO_RCVLOWAT' -- $cur ) )
+				SO_SNDLOWAT SO_RCVLOWAT' -- "$cur" ) )
 			return 0;
 			;;
 		-T)
 			COMPREPLY=( $( compgen -W 'c x I X F b g q r N a' -- \
-				$cur ) )
+				"$cur" ) )
 			return 0;
 			;;
 		-W|--workgroup)
@@ -93,7 +93,7 @@ _smbclient()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-b -d -L -U -I -M -m -A -N -i -O \
 			-p -R -s -k -P -c -D -W -l -E --debuglevel \
-			--log-basename --workgroup' -- $cur ) )
+			--log-basename --workgroup' -- "$cur" ) )
 	fi
 }
 complete -F _smbclient smbclient
@@ -127,7 +127,7 @@ _smbget()
 			--workgroup -n --nonprompt -d --debuglevel -D --dots \
 			-P --keep-permissions -o --outputfile -f --rcfile -q \
 			--quiet -v --verbose -b --blocksize -? --help --usage' \
-			-- $cur ) )
+			-- "$cur" ) )
 	fi
 }
 complete -F _smbget smbget
@@ -162,7 +162,7 @@ _smbcacls()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-a -M -D -S -U -C -G --numeric -t \
 			-h --help -V -s -d --debuglevel -l --log-basename' -- \
-			$cur ) )
+			"$cur" ) )
 	fi
 }
 complete -F _smbcacls smbcacls
@@ -197,7 +197,7 @@ _smbcquotas()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-u -L -F -S -n -t -v -h --help -V \
 			-s -d --debuglevel -l --log-basename -N -k -A \
-			--authentication-file -U --user' -- $cur ) )
+			--authentication-file -U --user' -- "$cur" ) )
 	fi
 }
 complete -F _smbcquotas smbcquotas
@@ -231,7 +231,7 @@ _smbpasswd()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-a -c -x -d -e -D -n -r -R -m -U -h \
-			-s -w -W -i -L' -- $cur ) )
+			-s -w -W -i -L' -- "$cur" ) )
 	fi
 }
 complete -F _smbpasswd smbpasswd
@@ -261,7 +261,7 @@ _smbtar()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-r -i -a -v -s -p -x -X -N -b -d -l \
-			-u -t' -- $cur ) )
+			-u -t' -- "$cur" ) )
 	fi
 }
 complete -F _smbtar smbtar
@@ -296,7 +296,7 @@ _smbtree()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-b -D -S -V -s -d --debuglevel -l \
 			--log-basename -N -k -A --authentication-file -U --user\
-			-h --help' -- $cur ) )
+			-h --help' -- "$cur" ) )
 	fi
 }
 complete -F _smbtree smbtree
diff --git a/contrib/sbcl b/contrib/sbcl
index 3dec851..2996a22 100644
--- a/contrib/sbcl
+++ b/contrib/sbcl
@@ -16,7 +16,7 @@ _sbcl()
     if [[ "$cur" == -* ]]; then
 	COMPREPLY=( $( compgen -W '--core --noinform --help --version \
                      --sysinit --userinit --eval --noprint --disable-debugger \
-                     --end-runtime-options --end-toplevel-options ' -- $cur ) )
+                     --end-runtime-options --end-toplevel-options ' -- "$cur" ) )
     else
 	_filedir
     fi
diff --git a/contrib/screen b/contrib/screen
index 3117f3d..bce19ef 100644
--- a/contrib/screen
+++ b/contrib/screen
@@ -17,7 +17,7 @@ _screen_sessions()
 	fi
 
 	COMPREPLY=( $( command screen -ls | \
-		sed -ne 's|^['$'\t'']\+\('$cur'[0-9]\+\.[^'$'\t'']\+\)'$pattern'$|\1|p' ) )
+		sed -ne 's|^['$'\t'']\+\('"$cur"'[0-9]\+\.[^'$'\t'']\+\)'"$pattern"'$|\1|p' ) )
 } &&
 _screen()
 {
@@ -60,7 +60,7 @@ _screen()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-a -A -c -d -D -e -f -fn -fa -h -i \
 			-l -ln -ls -list -L -m -O -p -q -r -R -s -S -t -U -v \
-			-wipe -x -X' -- $cur ) )
+			-wipe -x -X' -- "$cur" ) )
 	fi
 } &&
 complete -F _screen $default screen
diff --git a/contrib/shadow b/contrib/shadow
index 84164f6..0c150a3 100644
--- a/contrib/shadow
+++ b/contrib/shadow
@@ -29,12 +29,12 @@ _useradd()
 			_gids
 			[ -n "$bash205" ] && \
 				COMPREPLY=( "${COMPREPLY[@]}" $( compgen -g ) )
-			COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- $cur ) )
+			COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
 			return 0
 			;;
 		-G|--groups)
 			[ -n "$bash205" ] && \
-				COMPREPLY=( $( compgen -g -- $cur ) )
+				COMPREPLY=( $( compgen -g -- "$cur" ) )
 			return 0
 			;;
 		-s|--shell)
@@ -51,7 +51,7 @@ _useradd()
 			-G --groups -h --help -k --skel -K --key -l -M \
 			-m --create-home -N --no-user-group -o --non-unique \
 			-p --password -r --system -s --shell -u --uid \
-			-U --user-group -Z --selinux-user' -- $cur ) )
+			-U --user-group -Z --selinux-user' -- "$cur" ) )
 		return 0
 	fi
 } &&
@@ -79,12 +79,12 @@ _usermod()
 			_gids
 			[ -n "$bash205" ] && \
 				COMPREPLY=( "${COMPREPLY[@]}" $( compgen -g ) )
-			COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- $cur ) )
+			COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
 			return 0
 			;;
 		-G|--groups)
 			[ -n "$bash205" ] && \
-				COMPREPLY=( $( compgen -g -- $cur ) )
+				COMPREPLY=( $( compgen -g -- "$cur" ) )
 			return 0
 			;;
 		-s|--shell)
@@ -101,11 +101,11 @@ _usermod()
 			-e --expiredate -f --inactive -g --gid -G --groups \
 			-h --help -l --login -L --lock -o --non-unique \
 			-p --password -s --shell -u --uid -U --unlock \
-			-Z --selinux-user' -- $cur ) )
+			-Z --selinux-user' -- "$cur" ) )
 		return 0
 	fi
 
-	COMPREPLY=( $( compgen -u -- $cur ) )
+	COMPREPLY=( $( compgen -u -- "$cur" ) )
 } &&
 complete -F _usermod usermod
 
@@ -119,11 +119,11 @@ _userdel()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-f --force -h --help -r --remove' \
-			-- $cur ) )
+			-- "$cur" ) )
 		return 0
 	fi
 
-	COMPREPLY=( $( compgen -u -- $cur ) )
+	COMPREPLY=( $( compgen -u -- "$cur" ) )
 } &&
 complete -F _userdel userdel
 
@@ -149,11 +149,11 @@ _chage()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-d --lastday -E --expiredate \
 			-h --help -I --inactive -l --list -m --mindays \
-			-M --maxdays -W --warndays' -- $cur ) )
+			-M --maxdays -W --warndays' -- "$cur" ) )
 		return 0
 	fi
 
-	COMPREPLY=( $( compgen -u -- $cur ) )
+	COMPREPLY=( $( compgen -u -- "$cur" ) )
 } &&
 complete -F _chage chage
 
@@ -174,11 +174,11 @@ _passwd()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-k -l --stdin -u -d -n -x -w -i -S \
-			-? --help --usage' -- $cur ) )
+			-? --help --usage' -- "$cur" ) )
 		return 0
 	fi
 
-	COMPREPLY=( $( compgen -u -- $cur ) )
+	COMPREPLY=( $( compgen -u -- "$cur" ) )
 } &&
 complete -F _passwd passwd
 
@@ -196,7 +196,7 @@ _chpasswd()
 	case "$prev" in
 		-c|--crypt)
 			COMPREPLY=( $( compgen -W 'DES MD5 NONE SHA256 SHA512' \
-				-- $cur ) )
+				-- "$cur" ) )
 			return 0
 			;;
 		-s|--sha-rounds)
@@ -208,7 +208,7 @@ _chpasswd()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-c --crypt-method -e --encrypted \
-			-h --help -m --md5 -s --sha-rounds' -- $cur ) )
+			-h --help -m --md5 -s --sha-rounds' -- "$cur" ) )
 		return 0
 	fi
 } &&
@@ -228,7 +228,7 @@ _newusers()
 	case "$prev" in
 		-c|--crypt)
 			COMPREPLY=( $( compgen -W 'DES MD5 NONE SHA256 SHA512' \
-				-- $cur ) )
+				-- "$cur" ) )
 			return 0
 			;;
 		-s|--sha-rounds)
@@ -240,7 +240,7 @@ _newusers()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-c --crypt-method --r --system \
-			-s --sha-rounds' -- $cur ) )
+			-s --sha-rounds' -- "$cur" ) )
 		return 0
 	fi
 
@@ -257,7 +257,7 @@ _pwck()
 	cur=`_get_cword`
 
 	if [[ "$cur" == -* ]]; then
-		COMPREPLY=( $( compgen -W '-q -r -s' -- $cur ) )
+		COMPREPLY=( $( compgen -W '-q -r -s' -- "$cur" ) )
 		return 0
 	fi
 
@@ -290,7 +290,7 @@ _groupadd()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-f --force -g --gid -h --help \
 			-K --key -o --non-unique -p --password -r --system' \
-			-- $cur ) )
+			-- "$cur" ) )
 		return 0
 	fi
 } &&
@@ -320,11 +320,11 @@ _groupmod()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-g --gid -h --help -n --new-name \
-			-o --non-unique -p --password' -- $cur ) )
+			-o --non-unique -p --password' -- "$cur" ) )
 		return 0
 	fi
 
-	[ -n "$bash205" ] && COMPREPLY=( $( compgen -g -- $cur ) )
+	[ -n "$bash205" ] && COMPREPLY=( $( compgen -g -- "$cur" ) )
 } &&
 complete -F _groupmod groupmod
 
@@ -351,17 +351,17 @@ _gpasswd()
 
 	case "$prev" in
 		-a|-d|-A|-M)
-			COMPREPLY=( $( compgen -u -- $cur ) )
+			COMPREPLY=( $( compgen -u -- "$cur" ) )
 			return 0
 			;;
 	esac
 
 	if [[ "$cur" == -* ]]; then
-		COMPREPLY=( $( compgen -W '-a -d -r -R -A -M' -- $cur ) )
+		COMPREPLY=( $( compgen -W '-a -d -r -R -A -M' -- "$cur" ) )
 		return 0
 	fi
 
-	[ -n "$bash205" ] && COMPREPLY=( $( compgen -g -- $cur ) )
+	[ -n "$bash205" ] && COMPREPLY=( $( compgen -g -- "$cur" ) )
 } &&
 complete -F _gpasswd gpasswd
 
@@ -376,18 +376,18 @@ _groupmems()
 
 	case "$prev" in
 		-a|-d)
-			COMPREPLY=( $( compgen -u -- $cur ) )
+			COMPREPLY=( $( compgen -u -- "$cur" ) )
 			return 0
 			;;
 		-g)
 			[ -n "$bash205" ] && \
-				COMPREPLY=( $( compgen -g -- $cur ) )
+				COMPREPLY=( $( compgen -g -- "$cur" ) )
 			return 0
 			;;
 	esac
 
 	if [[ "$cur" == -* ]]; then
-		COMPREPLY=( $( compgen -W '-a -d -p -g -l' -- $cur ) )
+		COMPREPLY=( $( compgen -W '-a -d -p -g -l' -- "$cur" ) )
 		return 0
 	fi
 } &&
@@ -402,7 +402,7 @@ _grpck()
 	cur=`_get_cword`
 
 	if [[ "$cur" == -* ]]; then
-		COMPREPLY=( $( compgen -W '-r -s' -- $cur ) )
+		COMPREPLY=( $( compgen -W '-r -s' -- "$cur" ) )
 		return 0
 	fi
 
@@ -427,7 +427,7 @@ _vipw()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-g --group -h --help -p --passwd \
-			-q --quiet -s --shadow' -- $cur ) )
+			-q --quiet -s --shadow' -- "$cur" ) )
 		return 0
 	fi
 } &&
@@ -449,7 +449,7 @@ _faillog()
 			return 0
 			;;
 		-u|--user)
-			COMPREPLY=( $( compgen -u -- $cur ) )
+			COMPREPLY=( $( compgen -u -- "$cur" ) )
 			return 0
 			;;
 	esac
@@ -458,7 +458,7 @@ _faillog()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-a --all -h --help -l --lock-time \
-			-m --maximum -r --reset -t --time -u --user' -- $cur ) )
+			-m --maximum -r --reset -t --time -u --user' -- "$cur" ) )
 		return 0
 	fi
 } &&
@@ -480,7 +480,7 @@ _lastlog()
 			return 0
 			;;
 		-u|--user)
-			COMPREPLY=( $( compgen -u -- $cur ) )
+			COMPREPLY=( $( compgen -u -- "$cur" ) )
 			return 0
 			;;
 	esac
@@ -489,7 +489,7 @@ _lastlog()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-b --before -h --help -t --time \
-			-u --user' -- $cur ) )
+			-u --user' -- "$cur" ) )
 		return 0
 	fi
 } &&
diff --git a/contrib/sitecopy b/contrib/sitecopy
index a3322bc..e4dd686 100644
--- a/contrib/sitecopy
+++ b/contrib/sitecopy
@@ -15,14 +15,14 @@ _sitecopy()
 
 	case "$cur" in
 	    --*)
-	    	COMPREPLY=( $( compgen -W "$(sitecopy -h | grep -e '--\w' | awk '{sub (/=(FILE|PATH)/, "", $2); print $2}')" -- $cur ) )
+	    	COMPREPLY=( $( compgen -W "$(sitecopy -h | grep -e '--\w' | awk '{sub (/=(FILE|PATH)/, "", $2); print $2}')" -- "$cur" ) )
 		;;
 	    -*)
-	    	COMPREPLY=( $( compgen -W "$(sitecopy -h | grep -e '-\w' | awk '{sub (",", "", $1); print $1}')" -- $cur ) )
+	    	COMPREPLY=( $( compgen -W "$(sitecopy -h | grep -e '-\w' | awk '{sub (",", "", $1); print $1}')" -- "$cur" ) )
 		;;
 	    *)
 		if [ -r ~/.sitecopyrc ]; then
-		    COMPREPLY=( $( compgen -W "$(grep '^["$'\t '"]*site'  ~/.sitecopyrc | awk '{print $2}')" -- $cur ) )
+		    COMPREPLY=( $( compgen -W "$(grep '^["$'\t '"]*site'  ~/.sitecopyrc | awk '{print $2}')" -- "$cur" ) )
 		fi
 		;;
 	esac
diff --git a/contrib/smartctl b/contrib/smartctl
index a9fc68d..d401f81 100644
--- a/contrib/smartctl
+++ b/contrib/smartctl
@@ -6,7 +6,7 @@
 have smartctl && {
 _smartctl_quietmode()
 {
-	COMPREPLY=( $( compgen -W 'errorsonly silent noserial' -- $cur ) )
+	COMPREPLY=( $( compgen -W 'errorsonly silent noserial' -- "$cur" ) )
 }
 _smartctl_device()
 {
@@ -14,53 +14,53 @@ _smartctl_device()
 	for (( i=0; i <= 31; i++ )) ; do
 		opts="$opts 3ware,$i"
 	done
-	COMPREPLY=( $( compgen -W "$opts" -- $cur ) )
+	COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) )
 }
 _smartctl_tolerance()
 {
 	COMPREPLY=( $( compgen -W 'normal conservative permissive \
-		verypermissive' -- $cur ) )
+		verypermissive' -- "$cur" ) )
 }
 _smartctl_badsum()
 {
-	COMPREPLY=( $( compgen -W 'warn exit ignore' -- $cur ) )
+	COMPREPLY=( $( compgen -W 'warn exit ignore' -- "$cur" ) )
 }
 _smartctl_report()
 {
-	COMPREPLY=( $( compgen -W 'ioctl ataioctl scsiioctl' -- $cur ) )
+	COMPREPLY=( $( compgen -W 'ioctl ataioctl scsiioctl' -- "$cur" ) )
 }
 _smartctl_powermode()
 {
-	COMPREPLY=( $( compgen -W 'never sleep standby idle' -- $cur ) )
+	COMPREPLY=( $( compgen -W 'never sleep standby idle' -- "$cur" ) )
 }
 _smartctl_feature()
 {
-	COMPREPLY=( $( compgen -W 'on off' -- $cur ) )
+	COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
 }
 _smartctl_log()
 {
-	COMPREPLY=( $( compgen -W 'error selftest selective directory' -- $cur ) )
+	COMPREPLY=( $( compgen -W 'error selftest selective directory' -- "$cur" ) )
 }
 _smartctl_vendorattribute()
 {
 	COMPREPLY=( $( compgen -W 'help 9,minutes 9,seconds 9,halfminutes \
 		9,temp 192,emergencyretractcyclect 193,loadunload \
 		194,10xCelsius 194,unknown 198,offlinescanuncsectorct \
-		200,writeerrorcount 201,detectedtacount 220,temp' -- $cur ) )
+		200,writeerrorcount 201,detectedtacount 220,temp' -- "$cur" ) )
 }
 _smartctl_firmwarebug()
 {
 	COMPREPLY=( $( compgen -W 'none samsung samsung2 samsung3 swapid' \
-		-- $cur ) )
+		-- "$cur" ) )
 }
 _smartctl_presets()
 {
-	COMPREPLY=( $( compgen -W 'use ignore show showall' -- $cur ) )
+	COMPREPLY=( $( compgen -W 'use ignore show showall' -- "$cur" ) )
 }
 _smartctl_test()
 {
 	COMPREPLY=( $( compgen -W 'offline short long conveyance select \
-		afterselect,on afterselect,off pending scttempint' -- $cur ) )
+		afterselect,on afterselect,off pending scttempint' -- "$cur" ) )
 }
 
 
@@ -134,7 +134,7 @@ _smartctl()
 			-S --saveauto -H --health -c --capabilities -A \
 			--attributes -l --log -v --vendorattribute -F \
 			--firmwarebug -P --presets -t --test -C \
-			--captive -X --abort' -- $cur ) )
+			--captive -X --abort' -- "$cur" ) )
 	else
 		cur=${cur:=/dev/}
 		_filedir
diff --git a/contrib/snownews b/contrib/snownews
index 03cc609..47ab0e3 100644
--- a/contrib/snownews
+++ b/contrib/snownews
@@ -14,7 +14,7 @@ _snownews()
 	if [[ "$cur" == -* ]]; then
 		# return list of available options
 		COMPREPLY=( $( compgen -W '--update --help --version \
-				  --disable-versioncheck -u -h -V' -- $cur))
+				  --disable-versioncheck -u -h -V' -- "$cur"))
 	fi
 } &&
 complete -F _snownews snownews
diff --git a/contrib/ssh b/contrib/ssh
index e6e9de8..8c6b336 100644
--- a/contrib/ssh
+++ b/contrib/ssh
@@ -24,7 +24,7 @@ _ssh_options() {
 		ServerAliveInterval ServerAliveCountMax SmartcardDevice \
 		StrictHostKeyChecking TCPKeepAlive Tunnel TunnelDevice \
 		UsePrivilegedPort User UserKnownHostsFile VerifyHostKeyDNS \
-		VisualHostKey XAuthLocation' -- $cur ) )
+		VisualHostKey XAuthLocation' -- "$cur" ) )
 }
 
 _ssh()
@@ -45,17 +45,17 @@ _ssh()
 			COMPREPLY=( $( compgen -W '3des-cbc aes128-cbc \
 				aes192-cbc aes256-cbc aes128-ctr aes192-ctr \
 				aes256-ctr arcfour128 arcfour256 arcfour \
-				blowfish-cbc cast128-cbc' -- $cur ) )
+				blowfish-cbc cast128-cbc' -- "$cur" ) )
 			return 0
 			;;
 		-c)
 			COMPREPLY=( $( compgen -W 'hmac-md5 hmac-sha1 \
 				umac-64 at openssh.com hmac-ripemd160 \
-				hmac-sha1-96 hmac-md5-96' -- $cur ) )
+				hmac-sha1-96 hmac-md5-96' -- "$cur" ) )
 			return 0
 			;;
 		-l)
-			COMPREPLY=( $( compgen -u -- $cur ) )
+			COMPREPLY=( $( compgen -u -- "$cur" ) )
 			return 0
 			;;
 		-o)
@@ -69,7 +69,7 @@ _ssh()
 		-b)
 			COMPREPLY=( $( compgen -W "$(/sbin/ifconfig | \
 				awk '/adr:/ {print $2}' | \
-				awk -F: '{print $2}' )" -- $cur ) )
+				awk -F: '{print $2}' )" -- "$cur" ) )
 			return 0
 			;;
 	esac
@@ -83,7 +83,7 @@ _ssh()
 	elif [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-1 -2 -4 -6 -A -a -C -f -g -K -k -M \
 			-N -n -q -s -T -t -V -v -X -v -Y -y -b -b -c -D -e -F \
-			-i -L -l -m -O -o -p -R -S -w' -- $cur ) )
+			-i -L -l -m -O -o -p -R -S -w' -- "$cur" ) )
 	else
 		# Search COMP_WORDS for '-F configfile' or '-Fconfigfile' argument
 		set -- "${COMP_WORDS[@]}"
@@ -101,7 +101,7 @@ _ssh()
 		done
 		_known_hosts_real -a -F "$configfile" "$cur"
 		if [ $COMP_CWORD -ne 1 ]; then
-			COMPREPLY=( "${COMPREPLY[@]}" $( compgen -c -- $cur ) )
+			COMPREPLY=( "${COMPREPLY[@]}" $( compgen -c -- "$cur" ) )
 		fi
 	fi
 
@@ -138,7 +138,7 @@ _sftp()
 		cur=-F$cur  # Restore cur
 	elif [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-1 -C -v -B -b -F -o -P -R -S -s' \
-			-- $cur ) )
+			-- "$cur" ) )
 	else
 		# Search COMP_WORDS for '-F configfile' argument
 		set -- "${COMP_WORDS[@]}"
@@ -244,7 +244,7 @@ _ssh_copy_id() {
 	esac
 
 	if [[ "$cur" == -* ]]; then
-		COMPREPLY=( $( compgen -W '-i' -- $cur ) )
+		COMPREPLY=( $( compgen -W '-i' -- "$cur" ) )
 	else
 		_known_hosts_real -a "$cur"
 	fi
diff --git a/contrib/strace b/contrib/strace
index f9aef75..d96f4ea 100644
--- a/contrib/strace
+++ b/contrib/strace
@@ -58,14 +58,14 @@ _strace()
 				case $prev in
 					trace)
 						COMPREPLY=( $( compgen -W "$syscalls file process \
-							network signal ipc desc all none" -- $cur) )
+							network signal ipc desc all none" -- "$cur") )
 						return 0
 						;;
 				esac
 			else
 				COMPREPLY=( $( compgen -S"=" -W 'trace abbrev \
 					verbose raw signal read write' \
-					-- $cur ) )
+					-- "$cur" ) )
 			fi
 			return 0
 			;;
@@ -78,11 +78,11 @@ _strace()
 			return 0
 			;;
 		-S)
-			COMPREPLY=( $( compgen -W 'time calls name nothing' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'time calls name nothing' -- "$cur" ) )
 			return 0
 			;;
 		-u)
-			COMPREPLY=( $( compgen -u -- $cur ) )
+			COMPREPLY=( $( compgen -u -- "$cur" ) )
 			return 0
 			;;
 		esac
@@ -90,9 +90,9 @@ _strace()
 		if [[ "$cur" == -* ]]; then
 			COMPREPLY=( $( compgen -W '-c -d -f -ff -F -h --help -i -q \
 				-r -t -tt -ttt -T -v -V -x -xx -a -e -o -O -p \
-				-s -S -u -E' -- $cur ) )
+				-s -S -u -E' -- "$cur" ) )
 		else
-			COMPREPLY=( $( compgen -c -- $cur ) )
+			COMPREPLY=( $( compgen -c -- "$cur" ) )
 		fi
 	fi
 } &&
diff --git a/contrib/svk b/contrib/svk
index 07a430f..d25f5d5 100644
--- a/contrib/svk
+++ b/contrib/svk
@@ -21,9 +21,9 @@ _svk()
 
 	if [[ $COMP_CWORD -eq 1 ]] ; then
 		if [[ "$cur" == -* ]]; then
-			COMPREPLY=( $( compgen -W '--version' -- $cur ) )
+			COMPREPLY=( $( compgen -W '--version' -- "$cur" ) )
 		else
-			COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
+			COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) )
 		fi
 	else
 
@@ -215,12 +215,12 @@ _svk()
 			esac
 			options="$options --help -h"
 
-			COMPREPLY=( $( compgen -W "$options" -- $cur ) )
+			COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
 		else
 			case $command in
 				@(help|h|\?))
 					COMPREPLY=( $( compgen -W "$commands \
-					environment commands intro" -- $cur ) )
+					environment commands intro" -- "$cur" ) )
 					;;
 				admin)
 					COMPREPLY=( $( compgen -W 'help \
@@ -228,20 +228,20 @@ _svk()
 						list-dblogs list-unused-dblogs \
 						load lstxns recover rmtxns \
 						setlog verify rmcache' \
-						-- $cur ) )
+						-- "$cur" ) )
 					;;
 				patch)
 					COMPREPLY=( $( compgen -W '--ls --list \
 						--cat --view --regen \
 						--regenerate --up --update \
 						--apply --rm --delete' \
-						-- $cur ) )
+						-- "$cur" ) )
 					;;
 				sync)
 					COMPREPLY=( $( compgen -W "$( svk \
 						mirror --list 2>/dev/null | \
 						awk '/^\//{print $1}' )" \
-						-- $cur ) )
+						-- "$cur" ) )
 					;;
 				@(co|checkout|push|pull))
 				        if [[ "$cur" == //*/* ]]; then
@@ -250,7 +250,7 @@ _svk()
 						path=//
 					fi
 					COMPREPLY=( $( compgen -W "$( svk \
-						list $path 2>/dev/null | sed -e 's|\(.*\)|'$path'\1|')" -- $cur ) )
+						list $path 2>/dev/null | sed -e 's|\(.*\)|'$path'\1|')" -- "$cur" ) )
 					;;
 				*)
 					_filedir
diff --git a/contrib/sysctl b/contrib/sysctl
index 516fcc1..7860f42 100644
--- a/contrib/sysctl
+++ b/contrib/sysctl
@@ -11,7 +11,7 @@ _sysctl()
 	COMPREPLY=()
 	cur=`_get_cword`
 
-	COMPREPLY=( $( compgen -W "$(sysctl -N -a 2>/dev/null)" -- $cur ) )
+	COMPREPLY=( $( compgen -W "$(sysctl -N -a 2>/dev/null)" -- "$cur" ) )
 
 	return 0
 } &&
diff --git a/contrib/sysv-rc b/contrib/sysv-rc
index cee9fa8..8e194e9 100644
--- a/contrib/sysv-rc
+++ b/contrib/sysv-rc
@@ -28,9 +28,9 @@ _update_rc_d()
 	    | sort | uniq -u \
 	    ) )
 	COMPREPLY=( $( compgen -W '${options[@]} ${services[@]}' \
-	    -X '$( echo ${COMP_WORDS[@]} | tr " " "|" )' -- $cur ) )
+	    -X '$( echo ${COMP_WORDS[@]} | tr " " "|" )' -- "$cur" ) )
     elif [[ "$prev" == ?($( echo ${services[@]} | tr " " "|" )) ]]; then
-	COMPREPLY=( $( compgen -W 'remove defaults start stop' -- $cur ) )
+	COMPREPLY=( $( compgen -W 'remove defaults start stop' -- "$cur" ) )
     elif [[ "$prev" == defaults && "$cur" == [0-9] ]]; then
 	COMPREPLY=( 0 1 2 3 4 5 6 7 8 9 )
     elif [[ "$prev" == defaults && "$cur" == [sk]?([0-9]) ]]; then
@@ -58,7 +58,7 @@ _update_rc_d()
 	    COMPREPLY=()
 	fi
     elif [[ "$prev" == "." ]]; then
-	COMPREPLY=( $(compgen -W "start stop" -- $cur) )
+	COMPREPLY=( $(compgen -W "start stop" -- "$cur") )
     else
 	COMPREPLY=()
     fi
@@ -94,12 +94,12 @@ _invoke_rc_d()
 	    | sort | uniq -u \
 	    ) )
 	COMPREPLY=( $( compgen -W '${valid_options[@]} ${services[@]}' -- \
-	    $cur ) )
+	    "$cur" ) )
     elif [ -x $sysvdir/$prev ]; then
 	COMPREPLY=( $( compgen -W '`sed -ne "y/|/ /; \
 					    s/^.*Usage:[ ]*[^ ]*[ ]*{*\([^}\"]*\).*$/\1/p" \
 					    $sysvdir/$prev`' -- \
-	    $cur ) )
+	    "$cur" ) )
     else
 	COMPREPLY=()
     fi
diff --git a/contrib/tar b/contrib/tar
index 27b56b5..90885ea 100644
--- a/contrib/tar
+++ b/contrib/tar
@@ -12,7 +12,7 @@ _tar()
 	cur=`_get_cword`
 
 	if [ $COMP_CWORD -eq 1 ]; then
-		COMPREPLY=( $( compgen -W 'c t x u r d A' -- $cur ) )
+		COMPREPLY=( $( compgen -W 'c t x u r d A' -- "$cur" ) )
 		return 0
 	fi
 
diff --git a/contrib/tcpdump b/contrib/tcpdump
index bc867fd..3f72d7b 100644
--- a/contrib/tcpdump
+++ b/contrib/tcpdump
@@ -27,7 +27,7 @@ _tcpdump()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-a -d -e -f -l -n -N -O -p \
 			-q -R -S -t -u -v -x -C -F -i -m -r -s -T -w \
-			-E' -- $cur ) )
+			-E' -- "$cur" ) )
 	fi
 
 } &&
diff --git a/contrib/unace b/contrib/unace
index 2e05e8c..aaca67c 100644
--- a/contrib/unace
+++ b/contrib/unace
@@ -13,11 +13,11 @@ _unace()
 
 	case "$cur" in
 	    -*)
-		COMPREPLY=( $( compgen -W '-c -c- -f -f- -o -o- -p -y -y-' -- $cur ) )
+		COMPREPLY=( $( compgen -W '-c -c- -f -f- -o -o- -p -y -y-' -- "$cur" ) )
 		;;
 	    *)
 		if [ $COMP_CWORD -eq 1 ]; then
-			COMPREPLY=( $( compgen -W 'e l t v x' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'e l t v x' -- "$cur" ) )
 		else
 			_filedir '@(ace|ACE)'
 		fi
diff --git a/contrib/unrar b/contrib/unrar
index ec193b3..aa2bbaa 100644
--- a/contrib/unrar
+++ b/contrib/unrar
@@ -15,11 +15,11 @@ _unrar()
 	    -*)
 		COMPREPLY=( $( compgen -W '-ad -ap -av- -c- -cfg- -cl -cu \
 		-dh -ep -f -idp -ierr -inul -kb -o+ -o- -ow -p -p- -r -ta \
-		-tb -tn -to -u -v -ver -vp -x -x@ -y' -- $cur ) )
+		-tb -tn -to -u -v -ver -vp -x -x@ -y' -- "$cur" ) )
 		;;
 	    *)
 		if [ $COMP_CWORD -eq 1 ]; then
-			COMPREPLY=( $( compgen -W 'e l lb lt p t v vb vt x' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'e l lb lt p t v vb vt x' -- "$cur" ) )
 		else
 			_filedir '@(rar|RAR)'
 		fi
diff --git a/contrib/update-alternatives b/contrib/update-alternatives
index 021e3a1..f3b3346 100644
--- a/contrib/update-alternatives
+++ b/contrib/update-alternatives
@@ -17,7 +17,7 @@ _installed_alternatives()
 			break
 		fi
 	done
-	COMPREPLY=( $( compgen -W '$( command ls $admindir )' -- $cur ) )
+	COMPREPLY=( $( compgen -W '$( command ls $admindir )' -- "$cur" ) )
 }
 
 _update_alternatives()
@@ -85,9 +85,9 @@ _update_alternatives()
 		;;
 	*)
 		COMPREPLY=( $( compgen -W '--verbose --quiet --help --version \
-			       --altdir --admindir' -- $cur ) \
+			       --altdir --admindir' -- "$cur" ) \
 			    $( compgen -W '--install --remove --auto --display \
-			       --config' -- $cur ) )
+			       --config' -- "$cur" ) )
 	esac
 }
 complete -F _update_alternatives update-alternatives alternatives
diff --git a/contrib/vncviewer b/contrib/vncviewer
index 4b960e4..4898518 100644
--- a/contrib/vncviewer
+++ b/contrib/vncviewer
@@ -37,7 +37,7 @@ _tightvncviewer()
 			;;
 		-encodings)
 			COMPREPLY=( $( compgen -W 'copyrect tight hextile zlib \
-				corre rre raw' -- $cur ) )
+				corre rre raw' -- "$cur" ) )
 			return 0
 			;;
 		-via)
diff --git a/contrib/vpnc b/contrib/vpnc
index 6ab9ad5..9e5e9a4 100644
--- a/contrib/vpnc
+++ b/contrib/vpnc
@@ -15,11 +15,11 @@ _vpnc()
 	case $prev in
 		--pfs)
 			COMPREPLY=( $( compgen -W 'nopfs dh1 dh2 dh5 server' \
-				-- $cur ) )
+				-- "$cur" ) )
 			return 0
 			;;
 		--pfs)
-			COMPREPLY=( $( compgen -W 'dh1 dh2 dh5' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'dh1 dh2 dh5' -- "$cur" ) )
 			return 0
 			;;
 		--@(pid-file|script))
@@ -38,9 +38,9 @@ _vpnc()
 			--xauth-inter --script --dh --pfs --enable-1des \
 			--application-version --ifname --debug --no-detach \
 			--pid-file --local-port  --udp-port --disable-natt \
-			--non-inter' -- $cur ) )
+			--non-inter' -- "$cur" ) )
 	else
-		COMPREPLY=( $( compgen -W '$( command ls /etc/vpnc )' -- $cur ) )
+		COMPREPLY=( $( compgen -W '$( command ls /etc/vpnc )' -- "$cur" ) )
 	fi
 } &&
 complete -F _vpnc vpnc
diff --git a/contrib/wireless-tools b/contrib/wireless-tools
index fb166f9..58c1ebd 100644
--- a/contrib/wireless-tools
+++ b/contrib/wireless-tools
@@ -18,28 +18,28 @@ _iwconfig()
 	case $prev in
 		mode)
 			COMPREPLY=( $( compgen -W 'managed ad-hoc master \
-				repeater secondary monitor' -- $cur ) )
+				repeater secondary monitor' -- "$cur" ) )
 			return 0
 			;;
 		essid)
-			COMPREPLY=( $( compgen -W 'on off any' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'on off any' -- "$cur" ) )
 			if [ -n "${COMP_IWLIST_SCAN:-}" ]; then
 				COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
 					"$( iwlist ${COMP_WORDS[1]} scan | \
 					awk -F '\"' '/ESSID/ {print $2}' )" \
-					-- $cur ) )
+					-- "$cur" ) )
 			fi
 			return 0
 			;;
 		nwid)
-			COMPREPLY=( $( compgen -W 'on off' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
 			return 0
 			;;
 		channel)
 			COMPREPLY=( $( compgen -W \
 				"$( iwlist ${COMP_WORDS[1]} channel | \
 				awk '/^[[:space:]]*Channel/ {print $2}' )" \
-				-- $cur ) )
+				-- "$cur" ) )
 			return 0
 			;;
 
@@ -47,58 +47,58 @@ _iwconfig()
 			COMPREPLY=( $( compgen -W \
 				"$( iwlist ${COMP_WORDS[1]} channel | \
 				awk '/^[[:space:]]*Channel/ {print $4\"G\"}')" \
-				-- $cur ) )
+				-- "$cur" ) )
 			return 0
 			;;
 		ap)
-			COMPREPLY=( $( compgen -W 'on off any' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'on off any' -- "$cur" ) )
 			if [ -n "${COMP_IWLIST_SCAN:-}" ]; then
 				COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
 					"$( iwlist ${COMP_WORDS[1]} scan | \
 					awk -F ': ' '/Address/ {print $2}' )" \
-					-- $cur ) )
+					-- "$cur" ) )
 			fi
 			return 0
 			;;
 		rate)
-			COMPREPLY=( $( compgen -W 'auto fixed' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'auto fixed' -- "$cur" ) )
 			COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
 				"$( iwlist ${COMP_WORDS[1]} rate | \
 				awk '/^[[:space:]]*[0-9]/ {print $1\"M\"}' )" \
-				-- $cur ) )
+				-- "$cur" ) )
 			return 0
 			;;
 		rts|frag)
-			COMPREPLY=( $( compgen -W 'auto fixed off' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'auto fixed off' -- "$cur" ) )
 			return 0
 			;;
 		key|enc)
-			COMPREPLY=( $( compgen -W 'off on open restricted' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'off on open restricted' -- "$cur" ) )
 			return 0
 			;;
 		power)
-			COMPREPLY=( $( compgen -W 'period timeout off on' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'period timeout off on' -- "$cur" ) )
 			return 0
 			;;
 		txpower)
-			COMPREPLY=( $( compgen -W 'off on auto' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'off on auto' -- "$cur" ) )
 			return 0
 			;;
 		retry)
-			COMPREPLY=( $( compgen -W 'limit lifetime' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'limit lifetime' -- "$cur" ) )
 			return 0
 			;;
 	esac
 
 	if [ $COMP_CWORD -eq 1 ]; then
 		if [[ "$cur" == -* ]]; then
-			COMPREPLY=( $( compgen -W '--help --version' -- $cur ) )
+			COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) )
 		else
 			_available_interfaces -w
 		fi
 	else
 		COMPREPLY=( $( compgen -W 'essid nwid mode freq channel sens mode \
-			ap nick rate rts frag enc key power txpower commit' -- $cur ) )
+			ap nick rate rts frag enc key power txpower commit' -- "$cur" ) )
 	fi
 
 } &&
@@ -116,14 +116,14 @@ _iwlist()
 
 	if [ $COMP_CWORD -eq 1 ]; then
 		if [[ "$cur" == -* ]]; then
-			COMPREPLY=( $( compgen -W '--help --version' -- $cur ) )
+			COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) )
 		else
 			_available_interfaces -w
 		fi
 	else
 		COMPREPLY=( $( compgen -W 'scan scanning freq frequency \
 			channel rate bit bitrate key enc encryption power \
-			txpower retry ap accesspoint peers event' -- $cur ) )
+			txpower retry ap accesspoint peers event' -- "$cur" ) )
 	fi
 } &&
 complete -F _iwlist iwlist
@@ -139,12 +139,12 @@ _iwspy()
 
 	if [ $COMP_CWORD -eq 1 ]; then
 		if [[ "$cur" == -* ]]; then
-			COMPREPLY=( $( compgen -W '--help --version' -- $cur ) )
+			COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) )
 		else
 			_available_interfaces -w
 		fi
 	else
-		COMPREPLY=( $( compgen -W 'setthr getthr off' -- $cur ) )
+		COMPREPLY=( $( compgen -W 'setthr getthr off' -- "$cur" ) )
 	fi
 } &&
 complete -F _iwspy iwspy
@@ -161,23 +161,23 @@ _iwpriv()
 
 	case "$prev" in
 		roam)
-			COMPREPLY=( $( compgen -W 'on off' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
 			return 0
 			;;
 		port)
-			COMPREPLY=( $( compgen -W 'ad-hoc managed' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'ad-hoc managed' -- "$cur" ) )
 			return 0
 			;;
 	esac
 
 	if [ $COMP_CWORD -eq 1 ]; then
 		if [[ "$cur" == -* ]]; then
-			COMPREPLY=( $( compgen -W '--help --version' -- $cur ) )
+			COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) )
 		else
 			_available_interfaces -w
 		fi
 	else
-		COMPREPLY=( $( compgen -W '--all roam port' -- $cur ) )
+		COMPREPLY=( $( compgen -W '--all roam port' -- "$cur" ) )
 	fi
 } &&
 complete -F _iwpriv iwpriv
diff --git a/contrib/wodim b/contrib/wodim
index bb38971..8d10396 100644
--- a/contrib/wodim
+++ b/contrib/wodim
@@ -24,7 +24,7 @@ _cdrecord()
 			blank)
 				COMPREPLY=( $( compgen -W 'help all fast \
 				track unreserve trtail unclose session' \
-				-- $cur ) )
+				-- "$cur" ) )
 				return 0
 				;;
 			driveropts)
@@ -32,7 +32,7 @@ _cdrecord()
 				  varirec= audiomaster forcespeed noforcespeed\
 				  speedread nospeedread singlesession \
 				  nosinglesession hidecdr nohidecdr tattooinfo\
-				  tattoofile=' -- $cur ) )
+				  tattoofile=' -- "$cur" ) )
 				return 0
 				;;
 		esac
@@ -68,11 +68,11 @@ _cdrecord()
 	# files are always eligible completion
 	_filedir
 	# track options are always available
-	COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W '${track_options[@]}' -- $cur ) )
+	COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W '${track_options[@]}' -- "$cur" ) )
 	# general options are no more available after file or track option
 	if [ $track_mode -eq 0 ]; then
 		COMPREPLY=( "${COMPREPLY[@]}" \
-			    $( compgen -W '${generic_options[@]}' -- $cur ) )
+			    $( compgen -W '${generic_options[@]}' -- "$cur" ) )
 	fi
 
 } &&
diff --git a/contrib/wvdial b/contrib/wvdial
index e5c1f78..3c1fec3 100644
--- a/contrib/wvdial
+++ b/contrib/wvdial
@@ -23,7 +23,7 @@ _wvdial()
 		-*)
 			COMPREPLY=( $( compgen -W '--config --chat \
 				--remotename --help --version --no-syslog' \
-				-- $cur ) )
+				-- "$cur" ) )
 			;;
 		*)
 			# start with global and personal config files
diff --git a/contrib/xm b/contrib/xm
index 4e0cfd3..a70c21e 100644
--- a/contrib/xm
+++ b/contrib/xm
@@ -6,12 +6,12 @@
 have xm && {
 _xen_domain_names()
 {
-	COMPREPLY=( $(compgen -W "$( xm list 2>/dev/null | awk '!/Name|Domain-0/ { print $1 }'  )" -- $cur) )
+	COMPREPLY=( $(compgen -W "$( xm list 2>/dev/null | awk '!/Name|Domain-0/ { print $1 }'  )" -- "$cur") )
 }
 
 _xen_domain_ids()
 {
-	COMPREPLY=( $(compgen -W "$( xm list 2>/dev/null | awk '!/Name|Domain-0/ { print $2 }' )" -- $cur) )
+	COMPREPLY=( $(compgen -W "$( xm list 2>/dev/null | awk '!/Name|Domain-0/ { print $2 }' )" -- "$cur") )
 }
 
 _xm()
@@ -34,7 +34,7 @@ _xm()
 		cfgbootpolicy dumppolicy help'
 
 	if [[ $COMP_CWORD -eq 1 ]] ; then
-		COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
+		COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) )
 	else
 		prev=${COMP_WORDS[COMP_CWORD-1]}
 		if [[ "$cur" == *=* ]]; then
@@ -79,7 +79,7 @@ _xm()
 						--console_autoconnect'
 					;;
 			esac
-			COMPREPLY=( $( compgen -W "$options" -- $cur ) )
+			COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
 		else
 			case $command in
 				@(console|destroy|domname|domid|list|mem-@(set|max)|pause|reboot|rename|shutdown|unpause|vcpu-@(list|pin|set)|block-list|network-list|vtpm-list))
@@ -122,7 +122,7 @@ _xm()
 							_xen_domain_names
 							;;
 						3)
-							COMPREPLY=( $(compgen -W "r s e i u b" -- $cur) )
+							COMPREPLY=( $(compgen -W "r s e i u b" -- "$cur") )
 							;;
 					esac
 					;;
@@ -133,10 +133,10 @@ _xm()
 							_xen_domain_names
 							;;
 						3)
-							COMPREPLY=( $(compgen -W "phy: file:" -- $cur) )
+							COMPREPLY=( $(compgen -W "phy: file:" -- "$cur") )
 							;;
 						5)
-							COMPREPLY=( $(compgen -W "w r" -- $cur) )
+							COMPREPLY=( $(compgen -W "w r" -- "$cur") )
 							;;
 						6)
 							_xen_domain_names
@@ -150,7 +150,7 @@ _xm()
 							_xen_domain_names
 							;;
 						3)
-							COMPREPLY=( $(compgen -W "$( xm block-list $prev 2>/dev/null | awk '!/Vdev/ { print $1 }' )" -- $cur) )
+							COMPREPLY=( $(compgen -W "$( xm block-list $prev 2>/dev/null | awk '!/Vdev/ { print $1 }' )" -- "$cur") )
 							;;
 					esac
 					;;
@@ -161,7 +161,7 @@ _xm()
 							_xen_domain_names
 							;;
 						*)
-							COMPREPLY=( $(compgen -W "script= ip= mac= bridge= backend=" -- $cur) )
+							COMPREPLY=( $(compgen -W "script= ip= mac= bridge= backend=" -- "$cur") )
 							;;
 					esac
 					;;
@@ -172,7 +172,7 @@ _xm()
 							_xen_domain_names
 							;;
 						3)
-							COMPREPLY=( $(compgen -W "$( xm network-list $prev 2>/dev/null | awk '!/Idx/ { print $1 }' )" -- $cur) )
+							COMPREPLY=( $(compgen -W "$( xm network-list $prev 2>/dev/null | awk '!/Idx/ { print $1 }' )" -- "$cur") )
 							;;
 					esac
 					;;
@@ -189,7 +189,7 @@ _xm()
 					COMPREPLY=( ${COMPREPLY[@]:-} \
 						$( compgen -W '$( command ls \
 						/etc/xen 2>/dev/null )' \
-						-- $cur ) )
+						-- "$cur" ) )
 					;;
 				new)
 					case $prev in
diff --git a/contrib/xmllint b/contrib/xmllint
index 59d7570..3095356 100644
--- a/contrib/xmllint
+++ b/contrib/xmllint
@@ -42,7 +42,7 @@ _xmllint()
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '$( xmllint --help 2>&1 | \
 			sed -ne "s/^[[:space:]]*\(--[^[:space:]:]*\).*/\1/p" ) \
-			-o' -- $cur ) )
+			-o' -- "$cur" ) )
 		return 0
 	fi
 
diff --git a/contrib/xmlwf b/contrib/xmlwf
index 97e9bbd..b6ac40a 100644
--- a/contrib/xmlwf
+++ b/contrib/xmlwf
@@ -19,14 +19,14 @@ _xmlwf()
 			;;
 		-e)
 			COMPREPLY=( $( compgen -W 'US-ASCII UTF-8 UTF-16 \
-				ISO-8859-1' -- $cur ) )
+				ISO-8859-1' -- "$cur" ) )
 			return 0
 			;;
 	esac
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-c -d -e -m -n -p -r -s -t -v -w \
-			-x' -- $cur ) )
+			-x' -- "$cur" ) )
 		return 0
 	fi
 
diff --git a/contrib/xmms b/contrib/xmms
index fe9279c..c70b581 100644
--- a/contrib/xmms
+++ b/contrib/xmms
@@ -15,7 +15,7 @@ _xmms()
 		COMPREPLY=( $( compgen -W '-h --help -r --rew -p --play \
 			-u --pause -s --stop -t --play-pause -f --fwd -e \
 			--enqueue -m --show-main-window -i --sm-client-id \
-			-v --version' -- $cur ) )
+			-v --version' -- "$cur" ) )
 	else
 		_filedir '@(mp[23]|MP[23]|ogg|OGG|wav|WAV|pls|m3u|xm|mod|s[3t]m|it|mtm|ult|flac)'
 
diff --git a/contrib/xrandr b/contrib/xrandr
index 3dbd928..140e5e9 100644
--- a/contrib/xrandr
+++ b/contrib/xrandr
@@ -14,7 +14,7 @@ _xrandr()
 	case "$prev" in
 		--output)
 			local outputs=$(xrandr|grep 'connected'|awk '{print $1}')
-			COMPREPLY=( $(compgen -W "$outputs" -- $cur))
+			COMPREPLY=( $(compgen -W "$outputs" -- "$cur"))
 			return 0
 			;;
 		--mode)
@@ -26,7 +26,7 @@ _xrandr()
 			done
 			modes=$(xrandr|sed -e "1,/$output/ d" \
 			-e "/connected/,$ d"|awk '{print $1}')
-			COMPREPLY=( $( compgen -W "$modes" -- $cur))
+			COMPREPLY=( $( compgen -W "$modes" -- "$cur"))
 			return 0
 			;;
 	esac
@@ -41,7 +41,7 @@ _xrandr()
 					--preferred --pos --reflect --rotate \
 					--left-of --right-of --above --below \
 					--same-as --set --off --crtc --newmode \
-					--rmmode --addmode --delmode' -- $cur))
+					--rmmode --addmode --delmode' -- "$cur"))
 			return 0
 			;;
 	esac
diff --git a/contrib/xz b/contrib/xz
index 3cb93c9..118ef7a 100644
--- a/contrib/xz
+++ b/contrib/xz
@@ -17,7 +17,7 @@ _xz()
 			-0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -M --memory --lzma1 \
 			--lzma2 --x86 --powerpc --ia64 --arm --armthumb \
 			--sparc --delta -q --quiet -v --verbose -h --help \
-			-H --long-help -V --version' -- $cur ) )
+			-H --long-help -V --version' -- "$cur" ) )
 		return 0
 	fi
 
@@ -36,11 +36,11 @@ _xz()
 			;;
 		-C|--check)
 			COMPREPLY=( $( compgen -W 'crc32 crc64 sha256' \
-				-- $cur ) )
+				-- "$cur" ) )
 			return 0
 			;;
 		-F|--format)
-			COMPREPLY=( $( compgen -W 'auto xz lzma raw' -- $cur ) )
+			COMPREPLY=( $( compgen -W 'auto xz lzma raw' -- "$cur" ) )
 			return 0
 			;;
 		-M|--memory|-S|--suffix|--delta|--lzma1|--lzma2)
@@ -58,8 +58,8 @@ _xz()
 	_expand || return 0
 
 	local IFS=$'\t\n'
-	COMPREPLY=( $( compgen -f -X "$xspec" -- $cur ) \
-		$( compgen -d -- $cur ) )
+	COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
+		$( compgen -d -- "$cur" ) )
 } &&
 complete -F _xz $filenames xz
 
@@ -74,7 +74,7 @@ _xzdec()
 
 	if [[ "$cur" == -* ]]; then
 		COMPREPLY=( $( compgen -W '-M --memory -h --help -V --version' \
-			-- $cur ) )
+			-- "$cur" ) )
 		return 0
 	fi
 
diff --git a/contrib/yp-tools b/contrib/yp-tools
index 65722d2..878cfe9 100644
--- a/contrib/yp-tools
+++ b/contrib/yp-tools
@@ -18,11 +18,11 @@ _ypmatch()
 	   [ ${#COMP_WORDS[@]} -eq 3 ]; then
 		map=${COMP_WORDS[2]}
 		COMPREPLY=( $( compgen -W '$( ypcat $map | \
-						cut -d':' -f 1 )' -- $cur) )
+						cut -d':' -f 1 )' -- "$cur") )
 	else
 		[ $1 = ypmatch ] && [ $COMP_CWORD -ne 2 ] && return 0
 		COMPREPLY=( $( compgen -W \
-			      '$( echo $(ypcat -x | cut -d"\"" -f 2))' -- $cur))
+			      '$( echo $(ypcat -x | cut -d"\"" -f 2))' -- "$cur"))
 	fi
 
 	return 0
diff --git a/contrib/yum-arch b/contrib/yum-arch
index d9e6b4b..97bc410 100644
--- a/contrib/yum-arch
+++ b/contrib/yum-arch
@@ -13,7 +13,7 @@ _yum_arch()
 	case "$cur" in
 		-*)
 			COMPREPLY=( $( compgen -W '-d -v -vv -n -c -z -s -l \
-				-q' -- $cur ) )
+				-q' -- "$cur" ) )
 			;;
 		*)
 			_filedir -d

-- 
bash-completion



More information about the Bash-completion-commits mailing list