#!/bin/sh # # usage: wait-for-pid pid # # waits for /proc/pid to disappear from the /proc filesystem # if [ $# -ne 1 ] then echo Run wait-for-pid with one PID argument exit 2 fi pid="$1" numpid=`echo $pid | sed -e 's/[^0-9]//g'` if [ "$numpid" != "$pid" ] then echo pid $pid must be all decimial digits exit 2 fi if [ -d /proc/$pid ] then while [ -d /proc/$pid ] do sleep 1 done fi