MYPID=1234 if ps -p $MYPID >/dev/null; then echo alive else echo not-alive fiI read about this in Linux Journal.
Programming Tips - Linux: check if given process is alive
Date: 2008dec29
Update: 2024dec24
OS: Linux
Language: bash
Q. Linux: check if given process is alive
A. Use the -p option of `ps` like this: