diff --git a/share/functions/__fish_print_hostnames.fish b/share/functions/__fish_print_hostnames.fish index 1034b49a5..8bf21f8e8 100644 --- a/share/functions/__fish_print_hostnames.fish +++ b/share/functions/__fish_print_hostnames.fish @@ -105,10 +105,10 @@ function __fish_print_hostnames -d "Print a list of known hostnames" if test -r $file # Don't read from $file twice. We could use `while read` instead, but that is extremely # slow. - read -z -l contents <$file + 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 split ' ' | string match -v '*\**' + string replace -rfi '^\s*Host\s+(\S.*?)\s*$' '$1' -- $contents | string match -v '*\**' # Also extract known_host paths. set known_hosts $known_hosts (string replace -rfi '.*KnownHostsFile\s*' '' -- $contents) end