Using this
OF=$(ps fax | grep 'php-fpm: master process' | awk '{print $1}')
IDX=`expr index $OF ' '`
I get an error. The results of the $OF variable are:
27797 27495
What is the error here? I think it has to do with how the variable is being passed into the expression. Also, have tried putting ' quotes around the $OF variable to no avail. That just returns 0 as not found.
of=$(ps fax | awk '/php-fmp: master process/{print $1}'). However, if you have
pgrep` you better use pgrep. Also Explain in details what you want. – Valentin Bajrami Aug 07 '14 at 23:07