Fix finding known hosts files from SSH configs on systems with non-GNU sed.

There's no alternation functionality ('\|' or '|') in POSIX BRE.
This commit is contained in:
Ville Skyttä 2010-01-16 15:22:49 +02:00
parent 8d6570670a
commit 878c9dd5c9

View File

@ -1288,7 +1288,7 @@ _known_hosts_real()
# TODO(?): try to make known hosts files with more than one consecutive # TODO(?): try to make known hosts files with more than one consecutive
# spaces in their name work (watch out for ~ expansion # spaces in their name work (watch out for ~ expansion
# breakage! Alioth#311595) # 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[@]}" | sort -u ) ) tmpkh=( $( awk 'sub("^[[:space:]]*([Gg][Ll][Oo][Bb][Aa][Ll]|[Uu][Ss][Ee][Rr])[Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee][[:space:]]+", "") { print $0 }' "${config[@]}" | sort -u ) )
for i in "${tmpkh[@]}"; do for i in "${tmpkh[@]}"; do
# Remove possible quotes # Remove possible quotes
i=${i//\"} i=${i//\"}