LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 09-26-2003, 09:20 AM   #1
davi_cabral
LQ Newbie
 
Registered: Jul 2003
Location: Rio
Distribution: RedHat 7.2
Posts: 21

Rep: Reputation: 15
Aritmethical operations


Friends

MRTG returns me a variable corresponding to the CPU load an it has the following appearance:

23.9590874279
5.9590874279
It does vary from 0 to 100.

How can I take only the integer part in order to do some
"if test -gt" ??

Thanks
Davi
 
Old 09-26-2003, 11:04 AM   #2
maroonbaboon
Senior Member
 
Registered: Aug 2003
Location: Sydney
Distribution: debian
Posts: 1,495

Rep: Reputation: 48
Will this do?

% i=3.14157
% echo ${i%.[0-9]*}
3

See 'man bash' and look for parameter expansion for variations on this.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
C++:Operations with iterators frankie_DJ Programming 12 10-20-2005 03:39 AM
Unchecked or unsafe operations???? KissDaFeetOfSean Programming 1 09-12-2005 04:06 PM
Math operations with PHP linuxfond Linux - Newbie 1 04-20-2005 06:58 AM
Modem operations dbeyes Linux - Newbie 1 04-22-2003 06:09 PM
Copy/Paste operations Rex_chaos Linux - General 1 11-03-2001 06:41 AM


All times are GMT -5. The time now is 06:31 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration