I want to read a specific value from a /proc file, and currently that's done in a 'while read line' loop, as a scheleton:
while read line
do
if [[ $line = *MATCHES STRING* ]]; then
for (( i=0 ; i<=$someVAR-1; i++ ))
do
[if statement to check if the specific line is not equal with 0]
then [whatever]
done
fi
done < "/proc/FILE"
With that, I want to further improve the loop so that I can make count of how many times the if statement inside the for loop returns a value above 0. So the stop conditions should be like:
if line matches string then
for loop
do
use a variable to keep count that the conditions has been met 2 times.
When that occurs, the loop should stop and show a message.
ifstatement. After the loop, test the variable, and usebreakto stop the loop.countvariable inif(inside for loopif) and check thatcountoutside inwhileand usebreakto stop. simple