![]() |
how to assign output from bash command ps to array ?
Hi,
I have a command: ps aux|grep "$nameoftheprocess" |grep grep --invert-match|awk '{printf $2; } as an example: one result returns 3 PIDs like following: 769777057724 # which is 7697 7705 7724 I would like to assign those values into array. How to do it ? Thank you, Kind Regards, Martin |
Sorry, I solved it by:
PID_PS=( `ps aux|grep "${_PROC1}" |grep grep --invert-match|awk '{printf $2;printf "\n"; }'` ) |
Please don't. Try PIDS=($(pgrep $nameoftheprocess)).
|
Quote:
|
| All times are GMT -5. The time now is 08:18 AM. |