Register
It is currently Fri Sep 19, 2014 5:47 am

Problem with script


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Tue Oct 15, 2013 10:04 am   

Joined: Tue Oct 15, 2013 9:28 am
Posts: 1
Hi,
i have a little problem with my simple bash script. What i wanted to do is to have cpu1 temp checked in inf loop, every 1 second. Unfortunately i got some errors. What went wrong?


#!bin/sh

clear
maxtemp="80"
#echo $maxtemp
while [ 1 ]; do
x=`prtdiag -v | grep -w "CPU1" | awk '{ print $2}`
echo $x
if (("$x" -lt "$maxtemp")) then
echo "CPU1 Temp ok"
else
echo "CPU1 Temp too high"
fi
sleep 1
done


Top
 Profile  
 PostPosted: Tue Oct 15, 2013 3:08 pm   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 546
hi,

the problem comes from ``-lt'' that is not an arithmetic evaluation operator, but a test one.


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP