Skip to content

Instantly share code, notes, and snippets.

@ayust
Created November 30, 2012 21:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ayust/4178719 to your computer and use it in GitHub Desktop.
Save ayust/4178719 to your computer and use it in GitHub Desktop.
Wrapper for mosh that makes it work on systems where mosh doesn't seem to want to parse properly
#!/bin/bash
set -e
MOSH_IP="$(host -cIN "$1" | cut -d' ' -f4)"
MOSH_CONNECT_INFO="$(ssh -t "$1" -- "mosh-server" | grep "MOSH CONNECT" | tr -d '\r' | cut -d' ' -f3,4)"
read MOSH_PORT MOSH_KEY <<<"$MOSH_CONNECT_INFO"
MOSH_KEY="$MOSH_KEY" exec mosh-client "$MOSH_IP" "$MOSH_PORT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment