LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Aritmethical operations (https://www.linuxquestions.org/questions/linux-newbie-8/aritmethical-operations-97125/)

davi_cabral 09-26-2003 09:20 AM

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

maroonbaboon 09-26-2003 11:04 AM

Will this do?

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

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


All times are GMT -5. The time now is 02:05 PM.