mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-11 07:34:32 +00:00
functions/__fish_print_hostnames: Fix ssh_configs no values return (#6236)
* functions/__fish_print_hostnames: Fix ssh_configs no values return `string replace` not working with mutlilines variable. So split per line first. * functions/__fish_print_hostnames: remove quotes at `split '\n'` "\n with quotes" will cause `string split` weird issues. * functions/__fish_print_hostnames: using `read -alz -d \n` Fix `$contents` issues together
This commit is contained in:
parent
5b2250883a
commit
b89a6451a3
1 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue