Path: utzoo!attcan!uunet!crdgw1!montnaro From: montnaro@spyder.crd.ge.com (Skip Montanaro) Newsgroups: comp.unix.questions Subject: How to get PID in backgrounded /bin/sh while loop? Message-ID: Date: 20 Mar 90 14:45:31 GMT Sender: news@crdgw1.crd.ge.com Reply-To: montanaro@crdgw1.ge.com (Skip Montanaro) Organization: GE Corporate Research & Development, Schenectady, NY Lines: 24 Given the small shell script: #!/bin/sh ... do some stuff ... while true ; do ... do some loopy stuff ... done & how do you discover the process id of the backgrounded while loop process? A colleague suggested I write a small C program that just calls getppid(2), but that is overkill for the situation I have at hand. I've tried various combinations of quoting $$, evaling things containing it, and so on, but nothing yields helpful results. $! is undefined within the loop. -- Skip (montanaro@crdgw1.ge.com)