Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Uptime question (Unix-related)



On 2/14/07 1:15 PM, Ken Garland deftly typed out:

> I'd advise that both of you stop using cut for these types of tasks.
> Also, going directly to the proc for information when relevant is a
> preferred method. If this was to be executed on a Linux machine you'd
> want to use: awk '{gsub(/\./,"");print$1}' /proc/loadavg

One might argue that using 'uptime' would provide more universally usable
syntax (since 'uptime' is available on both Mac OS and Linux).

> If your uptime changes into more days than you have allowed for then
> your cut script will error. 48 characters is great for the single digit
> days of uptime, but what about when your server gets into triple digits?
> Taking directly from the proc and using the correct columns is the way
> to go.

Certainly I would agree that one should not use specific character position,
but rather use field number and delimiter:

uptime | cut -d " " -f 10

-Remo Del Bello 

-- 
"Television! Teacher, mother, secret lover."
- Homer Simpson


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Remote-desktop mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/remote-desktop/email@hidden

This email sent to email@hidden

References: 
 >Re: Uptime question (Unix-related) (From: Ken Garland <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.