#!/bin/bash if (($#<1)); then echo "usage: ${0##*/} " exit fi pid=$1 while [[ -d /proc/$pid ]]; do sleep 1 done