From owner-freebsd-bugs@FreeBSD.ORG Wed Dec 21 17:10:21 2005 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1DB8E16A41F for ; Wed, 21 Dec 2005 17:10:21 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 68CBD43D73 for ; Wed, 21 Dec 2005 17:10:13 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id jBLHACLH011122 for ; Wed, 21 Dec 2005 17:10:12 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id jBLHACX0011121; Wed, 21 Dec 2005 17:10:12 GMT (envelope-from gnats) Date: Wed, 21 Dec 2005 17:10:12 GMT Message-Id: <200512211710.jBLHACX0011121@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Oliver Fromme Cc: Subject: Re: bin/90690: ps(1) errorneously respects terminal column settings when output is not to a terminal X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Oliver Fromme List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2005 17:10:21 -0000 The following reply was made to PR bin/90690; it has been noted by GNATS. From: Oliver Fromme To: bug-followup@FreeBSD.org, vadim_nuclight@mail.ru Cc: Subject: Re: bin/90690: ps(1) errorneously respects terminal column settings when output is not to a terminal Date: Wed, 21 Dec 2005 18:00:06 +0100 (CET) What you describe is standard BSD ps(1) behaviour, as is documented in the manual page. Basically, the intent is that, when you redirect ps(1) output somewhere (to a file or pipe), you get exactly the same that is displayed on the screen. The rules are: If ps(1) is running in a terminal, it's width is used. If it's not running in a terminal (e.g. via a cron job) or the width cannot be determined, the default is 80 columns. To determine the terminal width, any one of stdout, stderr or stdin is used -- therefore, to let ps(1) ignore the terminal width, you have to redirect stderr and stdin. If you specify the -w option once, the limit is expanded to 132 columns (unless your terminal width is already larger than that). Finally, if you specify -w twice, the width is assumed to be unlimited. When you use ps(1) in a pipe to grep for things, you should always use the -ww options. Also note that newer versions of FreeBSD (> 4.x) have a pgrep(1) command which can be used as a convenient replacement for ps | grep pipes. Best regards Oliver -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd Any opinions expressed in this message may be personal to the author and may not necessarily reflect the opinions of secnetix in any way. I suggested holding a "Python Object Oriented Programming Seminar", but the acronym was unpopular. -- Joseph Strout