- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- comparing floating point with borne shell
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-25-2007 04:01 PM
тАО07-25-2007 04:01 PM
pcent=`egrep "noc" |awk '{print $10}'1
Then I compare pcent with 90 because if the process is greater than 90 I want to kill the process.
hival=90
if [ $pcent -gt $hival ]
then
(here is where I kill the process)
I guess when pcent have a value of 88.11 it does not test correctly. Any way to convert 88.11 to a whole value instead of a decimal point value.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-25-2007 04:18 PM
тАО07-25-2007 04:18 PM
SolutionThese are not the droids you want. :-)
There is no such thing as borne shell, only ksh and posix shell.
>Any way to convert 88.11 to a whole value instead of a decimal point value.
Just use awk's printf with integer format:
awk '{printf "%d\n", $10}'
Adding +.5 if you want to round up.
- Tags:
- awk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-25-2007 04:21 PM
тАО07-25-2007 04:21 PM
Re: comparing floating point with borne shell
- Tags:
- sed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-26-2007 09:55 AM
тАО07-26-2007 09:55 AM
Re: comparing floating point with borne shell
since you already have awk in use, let the work be done here. This makes no sense, however:
>>
pcent=`egrep "noc" |awk '{print $10}'1
<<
So lets assume you get it anyway (substitute 'print 77.95' by your command):
high=90
print 77.95 | awk -v h=high '{if ($1 >h) exit 1;exit 0}'
if [ $? -gt 0 ]
then
print CPU-usage more then $high
fi
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-26-2007 10:07 AM
тАО07-26-2007 10:07 AM