- 方法1
[ -x /proc/$PID ]
echo $? # 0 if exists, 1 otherwise
- 方法2
ps ho pid p $PID > /dev/null
echo $? # 0 if exists, 1 otherwise
More than 5 years have passed since last update.
[ -x /proc/$PID ]
echo $? # 0 if exists, 1 otherwise
ps ho pid p $PID > /dev/null
echo $? # 0 if exists, 1 otherwise
Register as a new user and use Qiita more conveniently