mirror of
https://github.com/junegunn/fzf.git
synced 2025-08-04 22:22:10 -07:00
[bash,zsh] Do not end the hostname analysis on "]" in ~/.ssh/known_hosts
An entry of the form `[example.com]:port,192.168.0.1 ...` in ~/.ssh/known_hosts are not properly processed. The current implementation gives up the matching on the first occurrence of `]`, the subsequent 192.168.0.1 would not be extracted. This patch continues the analysis and removes "]" together with "[". This patch also removes the ":port" part from the hostnames in ~/.ssh/known_hosts. One cannot use the form "hostname:port" in the arguments to the ssh command anyway.
This commit is contained in:
committed by
Junegunn Choi
parent
b5cd8880b1
commit
585cfaef8b
@@ -503,9 +503,9 @@ if ! declare -F __fzf_list_hosts > /dev/null; then
|
|||||||
) \
|
) \
|
||||||
<(
|
<(
|
||||||
__fzf_exec_awk -F ',' '
|
__fzf_exec_awk -F ',' '
|
||||||
match($0, /^[[a-zA-Z0-9.,:-]+/) {
|
match($0, /^[][a-zA-Z0-9.,:-]+/) {
|
||||||
$0 = substr($0, 1, RLENGTH)
|
$0 = substr($0, 1, RLENGTH)
|
||||||
gsub(/\[/, "")
|
gsub(/[][]|:[^,]*/, "")
|
||||||
for (i = 1; i <= NF; i++)
|
for (i = 1; i <= NF; i++)
|
||||||
print $i
|
print $i
|
||||||
}
|
}
|
||||||
|
@@ -281,9 +281,9 @@ if ! declare -f __fzf_list_hosts > /dev/null; then
|
|||||||
) \
|
) \
|
||||||
<(
|
<(
|
||||||
__fzf_exec_awk -F ',' '
|
__fzf_exec_awk -F ',' '
|
||||||
match($0, /^[[a-zA-Z0-9.,:-]+/) {
|
match($0, /^[][a-zA-Z0-9.,:-]+/) {
|
||||||
$0 = substr($0, 1, RLENGTH)
|
$0 = substr($0, 1, RLENGTH)
|
||||||
gsub(/\[/, "")
|
gsub(/[][]|:[^,]*/, "")
|
||||||
for (i = 1; i <= NF; i++)
|
for (i = 1; i <= NF; i++)
|
||||||
print $i
|
print $i
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user