#!/bin/bash

#This script opens a remote connection to an em400 instance using e4term. The
#URL is given as e4term://<host>:<port>

if [ ! "$1" ]
then
	echo "no URL provided" >&2
	exit 1
fi

if ! echo "$1" | grep -q '^e4term://'
then
	echo "URL does not start with e4term://" >&2
	exit 1
fi

e4term_args="`echo $1 | sed 's_e4term://__' | tr ':' ' '`"

exec x-terminal-emulator -e e4term $e4term_args
