if [ -e /proc/$PID ] or
if [ -n "$(ps -p $PID -o pid=)" ] In the latter form, -o pid= is an output format to display only the process ID column with no header. The quotes are necessary for non-empty string operator -n to give valid result.
if [ -e /proc/$PID ] or
if [ -n "$(ps -p $PID -o pid=)" ] In the latter form, -o pid= is an output format to display only the process ID column with no header. The quotes are necessary for non-empty string operator -n to give valid result.