I have a raspberry pi 4 with Ubuntu 20.04 installed. I'm new to linux and trying to log the temperature of the raspberry pi every few minutes.
I wrote a .sh file that I am trying to run but is not working right and I am not sure why.
#!/bin/bash
temp=$(/sys/class/thermal/thermal_zone0/temp)
temp_f=echo "$temp/1000" | bc -l
echo "Pi Temp: %.3fC\n" $temp_f >> /home/projects/temperature_logger/temp.log
When I try running this I get
./logscript.sh: line 2: /sys/thermal/thermal_zone0/temp: Permission Denied
./logscript.sh: line 3: /1000: No such file or directory
./logscript.sh: line 4: /home/projects/temperature_logger/temp.log: Permission Denied
How can I resolve these permission issues? I am logged in as ubuntu who is the only user on this pi.