1 2 3 4 5 6 7 8 9 10 11 12
#!/bin/bash if (($#<1)); then echo "usage: ${0##*/} <pid>" exit fi pid=$1 while [[ -d /proc/$pid ]]; do sleep 1 done