shell command to find a process id and attach to it?

前端 未结 6 1751
感动是毒
感动是毒 2021-01-14 14:04

I want to attach to a running process using \'ffffd\', what I manually do is:

# ps -ax | grep PROCESS_NAME

Then I get a list and the pid, the

6条回答
  •  旧时难觅i
    2021-01-14 14:21

    As separate commands:

    % PID=`ps -ax | grep ${PROCESS_NAME} | grep -v grep | cut -d ' ' -f 1-2`
    % ffffd ${PROCESS_NAME} ${PID}
    

    In one line:

    % PID=`ps -ax | grep ${PROCESS_NAME} | grep -v grep | cut -d ' ' -f 1-2` && ffffd ${PROCESS_NAME} ${PID}
    

提交回复
热议问题