ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
First of all, being a previous Microsoft Slave, being pretty good at VB, I got fed up and pretty much completely switched all my PC's to Kubuntu and my Server from Win2k to Ubuntu Server, I am slowly learning. but well luckily there is a great community to guide me. :-)
I'm running Ubuntu Server with lm-sensors installed.
For Cacti I would like to extract the raw temperature and Fan values without the fancy formatting from the sensors command.
So after a lot of searching and testing in /dev, /proc and /sys, I finally found that they are stored in /sys/bus/i2c/devices/9191-0290/
Location: Montpellier, France, Europe, World, Solar System
Distribution: Debian Sarge, Fedora core 5 (i386 and x86_64)
This line in your script:
basically says: put the string 'cat' in variable a and then try to run the command /sys/bus/i2c/devices/9191-0290/temp1_input. To say you want to put the result of the full command "cat /sys/bus/i2c/devices/9191-0290/temp1_input" into the variable, you need to surround it by backticks like that:
The perl example did work (presumably) but perl doesn't print a newline by default, so your prompt overwrote the output:
perl -ne 'print $_ / 1000.0, "\n"' ...
The shell can also do arithmetic itself with $(( ... )). Unfortunately bash is no use in this case as it can only handle integer arithmetic but more powerful shells like zsh can do floating point too, e.g.