diff options
-rw-r--r-- | share/functions/__fish_print_hostnames.fish | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/share/functions/__fish_print_hostnames.fish b/share/functions/__fish_print_hostnames.fish index 2c737a69..dd62b5c8 100644 --- a/share/functions/__fish_print_hostnames.fish +++ b/share/functions/__fish_print_hostnames.fish @@ -16,10 +16,15 @@ function __fish_print_hostnames -d "Print a list of known hostnames" # Does not match hostnames with @directives specified sgrep -Eoh '^[^#@|, ]*' ~/.ssh/known_hosts{,2} ^/dev/null + # Print hosts from system wide ssh configuration file + if [ -e /etc/ssh/ssh_config ] + # Ignore lines containing wildcards + sgrep -Eoi '^ *host[^*]*$' /etc/ssh/ssh_config | cut -d '=' -f 2 | tr ' ' '\n' + end + # Print hosts from ssh configuration file if [ -e ~/.ssh/config ] # Ignore lines containing wildcards sgrep -Eoi '^ *host[^*]*$' ~/.ssh/config | cut -d '=' -f 2 | tr ' ' '\n' end end - |