On 30/10/2013, at 14:02, Jason McMillon <[email protected]> wrote:

> 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)?
>  
> humidityInput=/sys/bus/i2c/devices/1-0040/humidity1_input
> echo $humidityInput
>  
> 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!
>  
> Jason

First get any linux/unix book real soon now.  If you do not know how to do 
this, you will stumble in many other things... 
You can find many used book very cheap. 


HI=`cat   /sys/bus/i2c/devices/1-0040/humidity1_input`     

Using backquotes. 
Besides bash does not make calculations in floating point.
You will need to use another tool, and there you have other reason to get an 
Unix/Linux book (not only a Bash book). 

Greetings

Paulo Ferreira 


-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to