Created
September 9, 2019 19:02
-
-
Save gngdb/9cef81bce3b37b7656695f092250ce7d to your computer and use it in GitHub Desktop.
Script for easy mosh connections
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/bash | |
ALGO_IP=`ip addr | awk ' | |
/^[0-9]+:/ { | |
sub(/:/,"",$2); iface=$2 } | |
/^[[:space:]]*inet / { | |
split($2, a, "/") | |
print iface" : "a[1] | |
}' | grep tun | cut -b 8- | cut -d "." -f 1-3 | sed 's/$/.1/'` | |
mosh --ssh="ssh -i algo.pem" ubuntu@$ALGO_IP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment