Running a program for a set amount of time

Ulrich Fahrenberg uli at math.auc.dk
Tue Nov 26 06:08:12 PST 2002


On Tue, 26 Nov 2002, Dan Osterrath wrote:

> > function runandkill () {
> > 	exec $1 &
> > 	sleep $2
> > 	kill $(pidof $1)
> > }
>
> I think exec replaces the actual shell by the new program.
> A simple "$1 &" would do it, wouldn't?

The function I gave is tested and works; but I think you are right.

uli

-- 
Ulrich Fahrenberg -- http://www.math.auc.dk/~uli

-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe blfs-support' in the subject header of the message



More information about the blfs-support mailing list