I was trying to write a shell script in unix environment and my requirement is if my condition is satisfied then it should note down how many times my condition is satisfied
for example in below code when the VAR value is 1 then it should note down how many times the value is 1 and keep recording the number in some specific file at certain path
VAR = /sys/ccc/sss
if [ "$VAR" -eq 1 ];
then /*need logic*/
fi
to be clear if ran above logic 100 times and my condition is true for 95 times then how to write a logic such that code should create a variable named condition_yes which has number 95 in it at end and varaible named condition_no which has number 5 in init Any idea or tip is appreciated
Requirement in nutshell My requirement is when i get a valid signal from external source a varaible in my sysfs located on my ecu at /sys/bus/drive/prd will be set to 1 and if not it will be set to 0 so my requirement is I continuosly send signal from an external source to my ecu for about 1 hr and at the end i want total count of how many times my signal is good and the varable above is set to 1