mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 05:28:49 +00:00
__fish_print_hostnames: use awk to process ssh_config files
Uses awk rather than sed to account for multiple formatting options. Closes #1260.
This commit is contained in:
parent
6ece8523b1
commit
f0d8d90ed1
1 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue