Skip to content
Myr

[bash,zsh] Support "=" after "Hostname" and "Host" in ~/.ssh/config

Before adoption: this commit came in with the history the project adopted, so no landing records it.

In ~/.ssh/config, "=" can also be used as a separator between the field name and the value. The current master does not properly handle this and generate a hostname "=" or one starting with "=". This patch correctly handles it.

authored by Koichi Murase · committed by Junegunn Choi · parent 4a61f53 · Browse files · 2 files+12 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+12 added−4 removed

  • other:+12 added−4 removed

2 files+12 added−4 removed

modified:shell/completion.bash+6 added-2 removed
492 unmodified lines
493 shopt -u dotglob nocaseglob failglob494 shopt -s nullglob495496 __fzf_exec_awk '497 tolower($1) ~ /^host(name)?$/ {498 for (i = 2; i <= NF; i++)497 # Note: mawk <= 1.3.3-20090705 does not support the POSIX brackets of498 # the form [[:blank:]], and Ubuntu 18.04 LTS still uses this499 # 16-year-old mawk unfortunately. We need to use [ \t] instead.500 match(tolower($0), /^[ \t]*host(name)?[ \t]*[ \t=]/) {501 $0 = substr($0, RLENGTH + 1) # Remove "Host(name)?=?"502 for (i = 1; i <= NF; i++)503 if ($i !~ /[*?%]/)504 print $i505 }506 ' ~/.ssh/config ~/.ssh/config.d/* /etc/ssh/ssh_config 2> /dev/null
180 unmodified lines
modified:shell/completion.zsh+6 added-2 removed
270 unmodified lines
271 # when no matching is found.272 setopt GLOB NO_DOT_GLOB CASE_GLOB NO_NOMATCH NULL_GLOB273274 __fzf_exec_awk '275 tolower($1) ~ /^host(name)?$/ {276 for (i = 2; i <= NF; i++)275 # Note: mawk <= 1.3.3-20090705 does not support the POSIX brackets of276 # the form [[:blank:]], and Ubuntu 18.04 LTS still uses this277 # 16-year-old mawk unfortunately. We need to use [ \t] instead.278 match(tolower($0), /^[ \t]*host(name)?[ \t]*[ \t=]/) {279 $0 = substr($0, RLENGTH + 1) # Remove "Host(name)?=?"280 for (i = 1; i <= NF; i++)281 if ($i !~ /[*?%]/)282 print $i283 }284 ' ~/.ssh/config ~/.ssh/config.d/* /etc/ssh/ssh_config 2> /dev/null
187 unmodified lines