Timeout a command in bash without unnecessary delay
So this is what I am trying to do -
for test in `ls Tests`; do
for file in `ls FileFolder`; do
output=`python devcap $test $file`
echo $test $file $output >>result.txt
How do I timeout the $output if it takes longer than say 5 seconds and move to the next $file?
Can I redirect the stderr to result.txt as well?