Last active
July 10, 2017 16:30
-
-
Save jlongman/5cfffee8a7a6f06f1ffdb28afdbe7f4d to your computer and use it in GitHub Desktop.
Output .ssh/config HostName entries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Output the HostName value from ~/.ssh/config | |
# SOURCE this, don't execute (e.g. "source ssh_host.sh" or ". ssh_host.sh") | |
# echos $@ if no HostName present | |
# Useful for shell substitution | |
# e.g. iperf -u -p 6970 -c $(ssh_host dev_backend) | |
ssh_host() { | |
ssh -G "$@" | grep -i '^hostname ' | awk '{print $2}' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment