#!/bin/bash endpoint=$1 if [[ $endpoint == *:* ]]; then host=${endpoint%:*} port=${endpoint#*:} mosh --ssh="ssh -p $port" $host else mosh $endpoint fi