shell 判斷pid是否真實存在

問題場景:根據指定的pid號,判斷該pid存在與否,存在需要結束掉該進程,不存在則不做處理。 代碼: PID=$(cat javapid.pid) PID_EXIST=$(ps aux | awk '{print $2}'| grep -w $PID) if [ ! $PID_EXIST ];then echo the process $PID is not exist else echo the
相關文章
相關標籤/搜索