#!/bin/sh

_onhost () {
    ssh=ssh
    sshopts=
    case "$1" in
	-1)
	    ssh=ssh1
	    shift
	    ;;
	-2)
	    ssh=ssh2
	    shift
	    ;;
	"")
	    echo "Usage:  $0 [-1 | -2] host command" 1>&2
	    return 1
	    ;;
	*)
	    ssh=ssh
	    ;;
    esac
    here=`uname -n`
    there="$1"
    shift
    if [ "$here" = "$there" ]; then
	#echo "$@"
	"$@"
    else
	#echo $ssh $sshopts -n $there "$@"
	$ssh -n $sshopts $there "$@"
    fi
}

_onhost "$@"
