misc/137647: ps output depends on terminals column width when
piping or redirecting
Michael Gmelin
freebsdusb at bindone.de
Mon Aug 10 21:20:03 UTC 2009
The following reply was made to PR misc/137647; it has been noted by GNATS.
From: Michael Gmelin <freebsdusb at bindone.de>
To: Ivan Radovanovic <rivanr at gmail.com>
Cc: freebsd-gnats-submit at FreeBSD.org
Subject: Re: misc/137647: ps output depends on terminals column width when
piping or redirecting
Date: Mon, 10 Aug 2009 22:49:52 +0200
Try using ps -wwaxj > ps.txt
afaik this is the intended behaviour of ps.
Ivan Radovanovic wrote:
>> Number: 137647
>> Category: misc
>> Synopsis: ps output depends on terminals column width when piping or redirecting
>> Confidential: no
>> Severity: non-critical
>> Priority: low
>> Responsible: freebsd-bugs
>> State: open
>> Quarter:
>> Keywords:
>> Date-Required:
>> Class: sw-bug
>> Submitter-Id: current-users
>> Arrival-Date: Mon Aug 10 20:40:01 UTC 2009
>> Closed-Date:
>> Last-Modified:
>> Originator: Ivan Radovanovic
>> Release: 7.2
>> Organization:
>> Environment:
> FreeBSD azdaja.softwarehood.com 7.2-STABLE FreeBSD 7.2-STABLE #0: Mon Aug 3 17:12:57 CEST 2009 rivan at azdaja.softwarehood.com:/usr/src/sys/i386/compile/Azdaja i386
>> Description:
> ps command formats its output according to setting of terminal it is running on even when piped or redirected to a file. This can cause serious confusion when using it in combination with other commands (for example ps -axj | grep opera won't give any output regardless opera browser is running in the example in "how to repeat" section)
>
>> How-To-Repeat:
> open xterm, set its width to 40 columns, do
> ps -axj > ps.txt
> ps.txt will be 40 columns wide
>
>> Fix:
> use isatty or stat to determine if ps's output is terminal
>
>> Release-Note:
>> Audit-Trail:
>> Unformatted:
> _______________________________________________
> freebsd-bugs at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
> To unsubscribe, send any mail to "freebsd-bugs-unsubscribe at freebsd.org"
More information about the freebsd-bugs
mailing list