I need to put the CPU value of a particular pid into a variable to detect its value.
I am able to get the pid
of the program by using pidof
and I am able to get the CPU value by using:
ps -p <pid> -o %cpu
which gives me:
%CPU
14.8
But I do no want the %CPU
part, just the value, to then put into a variable to then question whether it is above 90% or not.
Could you please offer any assistance?
Thank you.