{ 3 comments… read them below or add one }

1 Professor Fapsanders 10.03.08 at 5:37 pm

You can also do it with bash using sleep and job control:
$ foo & sleep 10 && kill %1 && fg

2 Jadu Saikia 01.15.09 at 10:16 am

Good one, I have to download and use it. Thanks.

The tip from Professor Fapsanders is also useful, we can make it more significant to kill the last background process by this:

$ sh foo & sleep 5 && kill $! && fg

// Jadu, unstableme.blogspot.com

3 Riccardo Murri 02.25.09 at 2:15 pm

Warning: the tip from Professor Fapsanders only works if “foo” does not require any input (background processes cannot do that).

For the general case, you need to background the alarm process instead, as the sample “timeout” script does.

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Tagged as: , , , , , , , , , , , , ,

Previous post: FreeBSD Apache Jail: Connection refused: connect to listener on 0.0.0.0:80 Error and Solution

Next post: How To Use UUID To Mount Partitions / Volumes Under Ubuntu Linux