Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!iuvax!cica!tut.cis.ohio-state.edu!n8emr!uncle!donlash From: donlash@uncle.UUCP (Donald Lashomb) Newsgroups: comp.lang.c Subject: Re: Getting PID of background process in shell script. Message-ID: <781@uncle.UUCP> Date: 24 Mar 90 23:54:40 GMT References: <3074@auspex.auspex.com> Reply-To: donlash@uncle.UUCP (Donald Lashomb) Organization: U.N.C.L.E. Lines: 15 In article <3074@auspex.auspex.com= hitz@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