From owner-freebsd-questions Sat Aug 18 8: 5:56 2001 Delivered-To: freebsd-questions@freebsd.org Received: from guru.mired.org (okc-27-141-144.mmcable.com [24.27.141.144]) by hub.freebsd.org (Postfix) with SMTP id 033D637B412 for ; Sat, 18 Aug 2001 08:05:52 -0700 (PDT) (envelope-from mwm@mired.org) Received: (qmail 47037 invoked by uid 100); 18 Aug 2001 15:05:06 -0000 From: Mike Meyer MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15230.33826.857877.794531@guru.mired.org> Date: Sat, 18 Aug 2001 10:05:06 -0500 To: parv Cc: questions@freebsd.org Subject: Re: ps & terminal width sensitivity inside a script In-Reply-To: <21892511@toto.iv> X-Mailer: VM 6.90 under 21.1 (patch 14) "Cuyahoga Valley" XEmacs Lucid X-face: "5Mnwy%?j>IIV\)A=):rjWL~NB2aH[}Yq8Z=u~vJ`"(,&SiLvbbz2W`;h9L,Yg`+vb1>RG% *h+%X^n0EZd>TM8_IB;a8F?(Fb"lw'IgCoyM.[Lg#r\ Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG parv types: > > There was no termcap or terminfo. There were no windows or even > > CRTs. Since everything was one or the other, ps(1) was written with > > three options, default, w, and ww at 80, 132, and unlimited width, > > respectively. Since LOTS of people wrote aliases and shell scripts that > > were linked to this hard-coded behavior, the very idea of changing it > > was met by screams of protest, so that's where we still are. > > so, in this day & age nobody (or not enough bodies) protests anymore? People do protect. The question is what's to protest about the current behavior of ps? First thing, I know of no way for a command to tell if it's being run from a script. So your original request isn't possible. What can be detected - and hence can cause a change in behavior - is whether any given output is attached to a terminal, and the width of that terminal. The three substantial possibilities here are output is a tty, output is not a tty but one can be found, and no tty can be found at all. The behavior we're discussing is the default output width. The current behavior is that it's the tty width if a tty can be found, otherwise ps uses the historical value of 80. I can't think of any other behavior that is clearly superior, much less clearly superior enough to warrant breaking any scripts that may depend on the current behavior. However, I'd be interested to know what behavior you'd like, and why you think it'd be an improvement. http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message