Taj Khattra (taj@intergate.bc.ca)
Tue, 20 Oct 1998 22:43:52 -0700 (PDT)
Brian Edmonds wrote:
> Some people have posted funky ps&grep things to check for the existance
> of a particular pid. If you're not concerned with ultra portability,
> then under Linux (and some other Unixes, but by no means all), you just
> have to check for the existance of files in /proc. Under Linux if pid X
> is a running process then there will be a directory /proc/X.
> #!/bin/sh
> # example of waiting for a pid (our argument) to end
> while [ -d /proc/$1 ]; do sleep 5; done
> echo "Done!"
another simple and portable method is:
while kill -0 $1 2>/dev/null; do sleep 1; done
-taj
This archive was generated by hypermail 2.0b3 on Mon 02 Nov 1998 - 03:23:18 PST