Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 6 down vote accepted

According to the Conky help, you can specify this in the config file ~/.conkyrc



  • Desired output unit of all objects displaying a temperature. Parameters are either "fahrenheit" or "celsius". The default unit is degree Celsius.
share|improve this answer
Guess I was just making another problem again - d'oh! Looks like I just scrolled past that option -_-. – WindowsEscapist Dec 9 '12 at 3:22

You need echo $temp*9/5+32 | bc. Variables are prefixed with a $ and can not be inside single quotes.

share|improve this answer
Both of these answers are correct! This works too but fabricator4 has less rep. Thanks! – WindowsEscapist Dec 9 '12 at 3:30
@WindowsEscapist, his answer is also a more direct answer to your question, I just wanted to explain what was wrong with your approach. – psusi Dec 9 '12 at 3:33
It seemed like the conky switch was the way to do it. I came across various methods in my research including the use of awk scripts that poll the sensor module directly. It's certainly a powerful way to do it, but perhaps a little more complicated than is warranted. – fabricator4 Dec 9 '12 at 4:34
He would also want && instead of & so that the value of temp is calcucated before calling bc – glenn jackman Dec 9 '12 at 20:44
@psusi I think I'm actually going to use this instead of the switch =p. Thanks for the answer! – WindowsEscapist Dec 9 '12 at 21:49

Get your $temp, and assuming /bin/bash why not just do this:

echo $[(${temp}*9/5)+32]
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.