[Bash-completion-devel] Bug#504141: Fixed error message and allowed spaces in config file

Freddy Vulto f.vulto at wanadoo.nl
Wed Nov 5 20:59:48 UTC 2008


Fixes:
- allows `configfile' to contain spaces:
- with `ssh -F<tab>' and `scp -F<tab>' you received an error message of
  _known_hosts: "bash: option requires an argument -- F"

=== modified file 'contrib/ssh'
--- contrib/ssh	2008-11-01 11:25:38 +0000
+++ contrib/ssh	2008-11-05 20:48:19 +0000
@@ -31,17 +31,17 @@
 		while [ $# -gt 0 ]; do
 			if [ "${1:0:2}" = -F ]; then
 				if [ ${#1} -gt 2 ]; then
-					optconfigfile="$1"
+					optconfigfile="$(dequote "$1")"
 				else
 					shift
-					optconfigfile="-F$1"
+					[ "$1" ] && optconfigfile="$(dequote "-F$1")"
 				fi
 				break
 			fi
 			shift
 		done
 		
-	    _known_hosts -a $optconfigfile
+	    _known_hosts -a "$optconfigfile"
 
 	    [ $COMP_CWORD -eq 1 -o -n "$optconfigfile" ] || \
 		COMPREPLY=( "${COMPREPLY[@]}" $( compgen -c -- $cur ) )
@@ -89,17 +89,17 @@
 	while [ $# -gt 0 ]; do
 		if [ "${1:0:2}" = -F ]; then
 			if [ ${#1} -gt 2 ]; then
-				optconfigfile="$1"
+				optconfigfile="$(dequote "$1")"
 			else
 				shift
-				optconfigfile="-F$1"
+				[ "$1" ] && optconfigfile="$(dequote "-F$1")"
 			fi
 			break
 		fi
 		shift
 	done
 
-	[[ "$cur" == */* ]] || _known_hosts -c -a $optconfigfile
+	[[ "$cur" == */* ]] || _known_hosts -c -a "$optconfigfile"
 		local IFS=$'\t\n'
 		COMPREPLY=( "${COMPREPLY[@]}" $( command ls -aF1d $cur* \
 			    2>/dev/null | sed \







More information about the Bash-completion-devel mailing list