#!/bin/sh set temp=1 while (temp=1) do minicom=`ps -auxg | grep 'new_minicom' | grep -v 'grep' | grep 'zelch'` pid=`ps -auxg | grep 'new_minicom' | grep -v 'grep' | grep 'zelch' | grep '?' | awk '{print $2}'` tty=`ps -auxg | grep 'new_minicom' | grep -v 'grep' | grep 'zelch' | awk '{print $7}' | grep '?'` if [ 'expr $tty : "?"' ] then kill -9 $pid fi # number of seconds to wait and try again sleep 300 done