#!/bin/bash usage() { echo "usage: rdp [-hf] HOST [PORT|INSTANCE]" } args=(-K -r sound) fs= while [ "${1:0:1}" = - ]; do a="$1" shift case "$a" in -h) usage exit 0 ;; -f) fs=y ;; esac done if [ "$fs" = y ]; then args=("${args[@]}" -f); else args=("${args[@]}" -g 1280x960); fi if [ $# -lt 1 ]; then usage >&2 exit 1 fi port=3389 if [ $# -ge 2 ]; then port="$2" if [ "$port" -lt 100 ]; then port=$((port + 3389)) fi fi exec rdesktop "${args[@]}" "$1:$port"