Getting PID of background process in shell script.
Donald Lashomb
donlash at uncle.UUCP
Sun Mar 25 09:54:40 AEST 1990
In article <3074 at auspex.auspex.com= hitz at auspex.auspex.com (Dave Hitz) writes:
=In a shell script I want to start a process in the background and then
=kill it at some later time. To do this I want to save it's pid in a
=variable.
=
=I can get the pid into a variable like this
=
= PID=` exec 2>&- sh -ic '( sleep 1000 0>&- 2>&- & ) 2>&1' `
=
=but this seems kind of ugly.
what about PID=$! - or am I misunderstanding something here.
-Don
More information about the Comp.lang.c
mailing list