#!/bin/bash
PC=pengyuzhou.com

stty rows 40 columns 80
comm=$(mosh-server new 2>/dev/null | grep -n "MOSH CONNECT" | tee /dev/tty |  awk '{ print "MOSH_KEY=" $4 " mosh-client 127.0.0.1 " $3 }')
echo "$comm #$HOSTNAME"

port=$(echo "$comm" | awk '{print $4}')  # port for local mosh-server

ncat -u "$PC" 50001 -c "echo; ncat -u 127.0.0.1 "$port"" # need to do a echo to trigger server
