coone4life
New Member
Hello guys,
i had a file called temperature.log
inside this file there are only numbers (another script write numbers into that file)
Sometimes the script runs into an error. At this point the script write letters in this log-file.
i need a command (maybe an if statement) to check if there are letters in this log.
what i have is this:
------------------------------------------------------------------------------------------------------
if test "/home/pi/GardenControl/TemperatureControl/temperature.log | grep -E [[:a-zA-Z:]]";
then echo "0" > /home/pi/GardenControl/TemperatureControl/temperature.log
fi
------------------------------------------------------------------------------------------------------
but this command writes a "0" all the time. even if there is a already a number in this log.
All the scripts runs on a rpi3b+ with debian on it.
can anyone help pls ?
i had a file called temperature.log
inside this file there are only numbers (another script write numbers into that file)
Sometimes the script runs into an error. At this point the script write letters in this log-file.
i need a command (maybe an if statement) to check if there are letters in this log.
what i have is this:
------------------------------------------------------------------------------------------------------
if test "/home/pi/GardenControl/TemperatureControl/temperature.log | grep -E [[:a-zA-Z:]]";
then echo "0" > /home/pi/GardenControl/TemperatureControl/temperature.log
fi
------------------------------------------------------------------------------------------------------
but this command writes a "0" all the time. even if there is a already a number in this log.
All the scripts runs on a rpi3b+ with debian on it.
can anyone help pls ?