Timeout a command in bash without unnecessary delay
I think this is precisely what you are asking for: http://www.bashcookbook.com/bashinfo/source/bash-4.0/examples/scripts/timeout3
I think this is precisely what you are asking for: http://www.bashcookbook.com/bashinfo/source/bash-4.0/examples/scripts/timeout3