I have a simple question, I want to store the output of the following command:
sudo iotop -t 0 -C 3 | grep "load: "
As you can see it is running all the time, and we get a new line every 3sec.
I just want to store these new lines into a single variable, so I can use it into a script.
To clear the screen, and do not print lines after the others when iotop is running just delete "- C".
I DO NOT WANT TO STORE THE OUTPUT ON THE DRIVE!!!
I DO NOT WANT TO KILL IOTOP, IT MUST BE RUNNING ALL THE TIME IN BACKGROUND!!!
The idea is to do not write on the drive! Just store the output into a single variable called $Activity.
Activity=$(sudo iotop -t 0 3 | grep "load: ") & While $Activity... do blahblah... done
But the fact is that nothing can be stored into Activity :(
So I have tried to know if something can be done to read the last output of a specified PID. But I need help on that point too :-/ I don't know how to do it.
Please help... :(