Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Aug 2001 10:05:06 -0500
From:      Mike Meyer <mwm@mired.org>
To:        parv <parv_@yahoo.com>
Cc:        questions@freebsd.org
Subject:   Re: ps & terminal width sensitivity inside a script
Message-ID:  <15230.33826.857877.794531@guru.mired.org>
In-Reply-To: <21892511@toto.iv>

next in thread | previous in thread | raw e-mail | index | archive | help
parv <parv_@yahoo.com> 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.

	<mike
--
Mike Meyer <mwm@mired.org>			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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15230.33826.857877.794531>