Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


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

Rep: Reputation: 15
Aritmethical operations


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

It does vary from 0 to 100.

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

Old 09-26-2003, 12:04 PM   #2
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]*}

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


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 04:39 AM
Unchecked or unsafe operations???? KissDaFeetOfSean Programming 1 09-12-2005 05:06 PM
Math operations with PHP linuxfond Linux - Newbie 1 04-20-2005 07:58 AM
Modem operations dbeyes Linux - Newbie 1 04-22-2003 07:09 PM
Copy/Paste operations Rex_chaos Linux - General 1 11-03-2001 07:41 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:42 AM.

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