summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVille Skyttä <ville.skytta@iki.fi>2011-11-05 00:38:37 +0200
committerVille Skyttä <ville.skytta@iki.fi>2011-11-05 00:38:37 +0200
commitb54d3f022f73553bdec64e1da29736d41835a029 (patch)
tree68079d50cff51dddcdcae419365ae714a0008308
parent55ec6a079b0a66eca2e4ed56f0757fc7c4ce34a5 (diff)
downloadbash-completion-b54d3f022f73553bdec64e1da29736d41835a029.tar.gz
_known_hosts_real: Discard @markers at beginning of line.
-rw-r--r--bash_completion6
-rw-r--r--test/fixtures/_known_hosts_real/known_hosts2
2 files changed, 5 insertions, 3 deletions
diff --git a/bash_completion b/bash_completion
index 637ca69a..8c8fab59 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1414,8 +1414,10 @@ _known_hosts_real()
if [ ${#kh[@]} -gt 0 ]; then
# FS needs to look for a comma separated list
COMPREPLY+=( $( awk 'BEGIN {FS=","}
- /^\s*[^|\#]/ {for (i=1; i<=2; ++i) { \
- sub(" .*$", "", $i); \
+ /^\s*[^|\#]/ {
+ sub("^@[^ ]+ +", ""); \
+ sub(" .*$", ""); \
+ for (i=1; i<=2; ++i) { \
sub("^\\[", "", $i); sub("\\](:[0-9]+)?$", "", $i); \
if ($i ~ /'"$awkcur"'/) {print $i} \
}}' "${kh[@]}" 2>/dev/null ) )
diff --git a/test/fixtures/_known_hosts_real/known_hosts b/test/fixtures/_known_hosts_real/known_hosts
index f655eaa3..0d6f5025 100644
--- a/test/fixtures/_known_hosts_real/known_hosts
+++ b/test/fixtures/_known_hosts_real/known_hosts
@@ -3,7 +3,7 @@
doo
ike ssh-rsa qwerty1234/Qwerty+1234==
jub,10.0.0.1
-kyl,100.0.0.2
+@cert-authority kyl,100.0.0.2 xxxfoo
[10.10.0.3]:10022
[blah]:1234
fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555