I\'m writing a mock-grading script in bash. It\'s supposed to execute a C program which will give some output (which I redirect to a file.) I\'m trying to (1) make it timeout af
This starts yourcommand, redirecting output via dd to youroutputfile and putting a limit of 10000000 bytes on it: dd will terminate and SIGPIPE will be sent to yourcommand
yourcommand | dd of=youroutputfile bs=1 count=10000000 &
This will wait 5 seconds and kill yourcommand if not already terminated:
sleep 5
kill %yourcommand