Date: Wed, 7 Jan 2009 09:27:24 -0800 From: "Sheldon Givens" <sheldon@sigsegv.ca> To: freebsd-hackers@freebsd.org Subject: Re: Small change to 'ps' Message-ID: <f4ecc0930901070927m2eec8770r9df984b21a97f5f7@mail.gmail.com> In-Reply-To: <20090107154854.GC1462@roadrunner.spoerlein.net> References: <f4ecc0930901061152q2ad01c4fj42dec8ad9fb201fa@mail.gmail.com> <20090107125759.GA1462@roadrunner.spoerlein.net> <alpine.BSF.2.00.0901070851560.43659@thor.farley.org> <20090107154854.GC1462@roadrunner.spoerlein.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jan 7, 2009 at 7:48 AM, Ulrich Spoerlein <uspoerlein@gmail.com>wrote: > On Wed, 07.01.2009 at 08:54:41 -0600, Sean C. Farley wrote: > > On Wed, 7 Jan 2009, Ulrich Spoerlein wrote: > > > > > On Tue, 06.01.2009 at 11:52:39 -0800, Sheldon Givens wrote: > > >> Hello everyone, > > >> > > >> It occurs to me that FreeBSD ps lacks the ability to disable header. > > >> This seems like a really obvious feature, and I may have simply > > >> missed it's existence (despite my relentlessly searching the man > > >> page) but here is a small patch that sets the flag 'n' to disable > > >> header output. > > > > > > You've missed it, probably because it is non-obvious: > > > > > > % ps -p 1 -o pid,cpu > > > PID CPU > > > 1 0 > > > % ps -p 1 -o pid= -o cpu= > > > 1 0 > > > % > > > > Another way: > > ps | tail +2 > > I'm not sure about the portability of tail +N, I seem to remember that > AIX doesn't support it. Therefore I'd rather use > > % ps | sed 1d > > which is way more portable. > > Cheers, > Ulrich Spoerlein > -- > It is better to remain silent and be thought a fool, > than to speak, and remove all doubt. > Hello everybody, Ulrich: I appreciate your solution, but it ends up being a pretty ridiculous command when you start desiring 6 or 7 fields. Sean: Ulrich is right in saying that tail +val is unreliable when coding for portability. And I guess I just feel like running a second command to do what should be possible to do with the first command (and is, on many platforms. ps --no-headers on linux for example) is a problem and presents opportunity for continued refinement of the utility. Sheldon
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?f4ecc0930901070927m2eec8770r9df984b21a97f5f7>