From 4f47636838abe4a56b6be3b154466abbd6b37b3b Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Tue, 3 Mar 2020 18:28:27 +0100 Subject: [PATCH] fish_print_hostnames: Fix multiple host aliases Fixes #6698. [ci skip] --- share/functions/__fish_print_hostnames.fish | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/share/functions/__fish_print_hostnames.fish b/share/functions/__fish_print_hostnames.fish index 26e3461da..30ee6a5c3 100644 --- a/share/functions/__fish_print_hostnames.fish +++ b/share/functions/__fish_print_hostnames.fish @@ -108,7 +108,8 @@ function __fish_print_hostnames -d "Print a list of known hostnames" read -alz -d \n contents <$file # Print hosts from system wide ssh configuration file - string replace -rfi '^\s*Host\s+(\S.*?)\s*$' '$1' -- $contents | string match -v '*\**' + # Multiple names for a single host can be given separated by spaces, so just split it explicitly (#6698). + string replace -rfi '^\s*Host\s+(\S.*?)\s*$' '$1' -- $contents | string split " " | string match -v '*\**' # Also extract known_host paths. set known_hosts $known_hosts (string replace -rfi '.*KnownHostsFile\s*' '' -- $contents) end