diff options
| author | Koichi Murase <myoga.murase@gmail.com> | 2025-06-04 12:27:30 +0900 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2025-06-09 21:46:53 +0900 |
| commit | 2bd29c3172bb87e447450b8b2034b4dd868fd97c (patch) | |
| tree | f612db1552e686d5eaa2f7eb1e08fd01db332c2f /shell/completion.bash | |
| parent | 4a61f53b85d4a6640b656f8442c40fb9cfb8df2d (diff) | |
| download | fzf-2bd29c3172bb87e447450b8b2034b4dd868fd97c.tar.gz | |
[bash,zsh] Support "=" after "Hostname" and "Host" in ~/.ssh/config
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.
Diffstat (limited to 'shell/completion.bash')
| -rw-r--r-- | shell/completion.bash | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/shell/completion.bash b/shell/completion.bash index 48a34c9b..044a35f6 100644 --- a/shell/completion.bash +++ b/shell/completion.bash @@ -494,8 +494,12 @@ if ! declare -F __fzf_list_hosts > /dev/null; then shopt -s nullglob __fzf_exec_awk ' - tolower($1) ~ /^host(name)?$/ { - for (i = 2; i <= NF; i++) + # Note: mawk <= 1.3.3-20090705 does not support the POSIX brackets of + # the form [[:blank:]], and Ubuntu 18.04 LTS still uses this + # 16-year-old mawk unfortunately. We need to use [ \t] instead. + match(tolower($0), /^[ \t]*host(name)?[ \t]*[ \t=]/) { + $0 = substr($0, RLENGTH + 1) # Remove "Host(name)?=?" + for (i = 1; i <= NF; i++) if ($i !~ /[*?%]/) print $i } |
