Print a degree symbol from a bash script in RedHat.

I wrote plugin for Nagios the other day. This script is just to show the current temperature values of the 3 build in ambient temp sensor in the chassis of a Dell e1000. A problem was to create the degree symbol ‘°‘. I ‘Googled’ a while and found a lot of solutions, but none of them worked for me. I don’t know if it was because of the SSH terminal or the keyboard driver. I saw loads of different symbols but none of them looked even close to what I was looking for. Finally I found a way to create that symbol.
[root@NAGIOS ~]# DEGCEL="\0260C"; echo -e $DEGCEL
°C

About Juergen Caris

I am 54yo, MSc(Dist) and BSc in Computer Science, German and working as a Senior Server Engineer for the NHS Lothian. I am responsible for the patient management system, called TrakCare. I am a UNIX/Linux guy, working in this sector for more than 20 years now. I am also interested in robotics, microprocessors, system monitoring, Home automation and programming.
This entry was posted in Bash. Bookmark the permalink.

1 Response to Print a degree symbol from a bash script in RedHat.

  1. Chris says:

    Hi,
    I just stumbled over this here. How can one use a degree-sign inside of a “check_command”, for example for the “units” option?
    I tried something like:
    check_command check_snmp!-C public -o upsAdvBatteryTemperature.0 -w 30 -c 40 -u ‘260C’
    but that doesn’t work… Any ideas?
    TIA!

Leave a Reply

Your email address will not be published.