diff --git a/bash_completion b/bash_completion index 9cee4250..e3b782c0 100644 --- a/bash_completion +++ b/bash_completion @@ -1260,9 +1260,12 @@ _known_hosts_real() local OIFS=$IFS IFS=$'\n' local -a tmpkh # expand paths (if present) to global and user known hosts files - tmpkh=( $( sed -ne 's/^[ \t]*\([Gg][Ll][Oo][Bb][Aa][Ll]\|[Uu][Ss][Ee][Rr]\)[Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee]['"$'\t '"']*\(.*\)$/"\2"/p' "${config[@]}" ) ) - for i in "${tmpkh[@]}"; do - i=$( echo "${i//\"/}" ) + # TODO(?): try to make known hosts files with more than one consecutive + # spaces in their name work (watch out for ~ expansion + # breakage! Alioth#311595) + tmpkh=( $( sed -ne 's/^[ \t]*\([Gg][Ll][Oo][Bb][Aa][Ll]\|[Uu][Ss][Ee][Rr]\)[Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee]['"$'\t '"']*\(.*\)$/\2/p' "${config[@]}" ) ) + for i in "${tmpkh[@]//\"/}"; do + i=$( eval echo "$i" ) # expand ~ [ -r "$i" ] && kh=( "${kh[@]}" "$i" ) done IFS=$OIFS