1#!/bin/rc 2# await secs cmd ... - wait at most secs for cmd to complete, but don't kill it. 3# cmd's stdin will be /dev/null. 4switch ($#*) { 5case 0 1 6 echo usage: $0: 'maxsecs cmd ...' >[1=2] 7 exit usage 8} 9 10rfork e 11secs=$1 12shift 13 14$* & 15cmdpid=$apid 16 17for (s in `{seq $secs}) 18 if (test -e /proc/$cmdpid) 19 sleep 1 20if (test -e /proc/$cmdpid) 21 echo $0: $"*: still running >[1=2] 22