Home How to timeout within a bash script?
Reply: 1

How to timeout within a bash script?

user1738845
1#
user1738845 Published in 2012-10-29 03:08:29Z

Possible Duplicate:
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

done

done

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?

Jeff Robert Dagala
2#
Jeff Robert Dagala Reply to 2012-10-29 06:27:58Z

try this:

for test in `ls Tests`; do

for file in `ls FileFolder`; do

output=`python devcap $test $file`

sleep 5

echo $test $file $output >>result.txt

done

done
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.308577 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO