#!/bin/sh
# timeout script
#
usage()
{
	echo "usage: timeout seconds command args ..."
	exit 1
}

[[ $# -lt 2 ]] && usage
seconds=$1; shift

timeout()
{
	sleep $seconds
	kill -9 $pid >/dev/null 2>/dev/null
}

eval "$@" &
pid=$!
timeout &
wait $pid 
