Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

return background process id

Status
Not open for further replies.

rayshi2001

Programmer
Jun 9, 2002
1
US
How can I save the PID of a background process when it is started in shell script?

Note that redirect >err or >>err don't work.
 
you can get the PID of the background process using $! shell variable
e.g
lp Myfile &
Pid=$!
wait $Pid

will wait for the print job to finish, the pid will be in $Pid
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top