#!/bin/sh
#
# ungetty <tty> <command> - stop getty on <tty> and run <command>
# tty is S0 or S1 or...
# e.g. ungetty S0 uucico -r1
#

GETTY=`ps -aux | awk "/getty/ { if (\\$7==\"$1\") print \\$2 }"`
shift
kill -TSTP $GETTY
$@
kill -CONT $GETTY
