So I am the proud owner of a weather cape and beagle bone white and a newb when it comes to bash scripting.
Lets say I want to otput to the command line the relative humidity as a percentage using a bash script.
Getting the relative humidity is as easy as cat /sys/bus/i2c/devices/1-0040/humidity1_input
How do I assign this value to a variable in a bash script so that I can manipulate it (specificall divide by 1000 to express as a percentage)?
gives me /sys/bus/i2c/devices/1-0040/humidity1_input
I have tried putting paranthesis, quotes, and single quotes around “/sys/bus/i2c/devices/1-0040/humidity1_input” but can’t get bash to assign the value of the file to the variable.
Any of you linux gurus want to help a new out?
Thanks in advance!