Converting Celsius Processor Temperature to Fahrenheit

Posted by WindowsEscapist on Ask Ubuntu See other posts from Ask Ubuntu or by WindowsEscapist
Published on 2012-12-09T02:35:36Z Indexed on 2012/12/09 11:20 UTC
Read the original article Hit count: 245

Filed under:
|
|
|
|

I'm editing a Conky theme. I would like it to output the processor temperatures in degrees Fahrenheit instead of Celsius.

In the ~/.conkyrc file, the command sensors | grep 'Core 0' | cut -c18-19 is used to find the temperature in Celsius for the first processor core. I want to use bc to compute this (give it outputvalue*9/5+32).

Problem is, bc wants just absolute values, and I see no way to pass it program output. If I try to use something like temp=$(sensors | grep 'Core 0' | cut -c18-19) & echo 'temp*9/5+32' | bc, it ends up giving me 32 because it registers "temp" as a 0.

© Ask Ubuntu or respective owner

Related posts about command-line

Related posts about bash