Ignore "host", "hostname", and hostname wildcards

See the PATTERNS section of ssh_config(5) for wildcards supported by ssh.
This commit is contained in:
Michael Stillwell 2014-01-23 14:59:19 +00:00 committed by Konrad Borowski
parent 9bfb4f1e11
commit 133ba6e01b

View file

@ -18,13 +18,11 @@ function __fish_print_hostnames -d "Print a list of known hostnames"
# 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'
sgrep -Eoi '^ *host[^*]*$' /etc/ssh/ssh_config | cut -d ' ' -f 2 | tr ' ' '\n' | sgrep -v '[\*\?\!]'
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'
sgrep -Eoi '^ *host[^*]*$' ~/.ssh/config | cut -d ' ' -f 2 | tr ' ' '\n' | sgrep -v '[\*\?\!]'
end
end