Blob Blame History Raw
diff --git a/bash_completion b/bash_completion
index f7e1a28..98f35ca 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1298,8 +1298,7 @@ _known_hosts_real()
             COMPREPLY=( "${COMPREPLY[@]}" $( awk 'BEGIN {FS=","}
             /^\s*[^|\#]/ {for (i=1; i<=2; ++i) { \
             gsub(" .*$", "", $i); \
-            gsub("[\\[\\]]", "", $i); \
-            gsub(":[0-9]+$", "", $i); \
+            sub("^\\[", "", $i); sub("\\](:[0-9]+)?$", "", $i); \
             if ($i ~ /'"$awkcur"'/) {print $i} \
             }}' "${kh[@]}" 2>/dev/null ) )
         fi