diff options
author | David Adam <zanchey@ucc.gu.uwa.edu.au> | 2014-09-29 14:08:09 +0800 |
---|---|---|
committer | David Adam <zanchey@ucc.gu.uwa.edu.au> | 2014-09-29 14:08:09 +0800 |
commit | f0d8d90ed1c2fee0696b0ee96759ee2299ce6651 (patch) | |
tree | 9962ed0855096077839cc26d0de7722f8c690faf /share/functions/__fish_print_hostnames.fish | |
parent | 6ece8523b112871f49afc374c7bbe8aeaa3dc047 (diff) |
__fish_print_hostnames: use awk to process ssh_config files
Uses awk rather than sed to account for multiple formatting options.
Closes #1260.
Diffstat (limited to 'share/functions/__fish_print_hostnames.fish')
-rw-r--r-- | share/functions/__fish_print_hostnames.fish | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/share/functions/__fish_print_hostnames.fish b/share/functions/__fish_print_hostnames.fish index 1ad43151..eadb21f5 100644 --- a/share/functions/__fish_print_hostnames.fish +++ b/share/functions/__fish_print_hostnames.fish @@ -18,11 +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 ] - sgrep -Eoi '^ *host[^*]*$' /etc/ssh/ssh_config | cut -d ' ' -f 2 | tr ' ' '\n' | sgrep -v '[\*\?\!]' + awk -v FS="[ =]+" -v OFS='\n' 'tolower($0) ~ /^ *host[^*?!]*$/{ $1=""; print }' /etc/ssh/ssh_config end # Print hosts from ssh configuration file if [ -e ~/.ssh/config ] - sgrep -Eoi '^ *host[^*]*$' ~/.ssh/config | cut -d ' ' -f 2 | tr ' ' '\n' | sgrep -v '[\*\?\!]' + awk -v FS="[ =]+" -v OFS='\n' 'tolower($0) ~ /^ *host[^*?!]*$/{ $1=""; print }' ~/.ssh/config end end |