misc/137647: ps output depends on terminals column width when
piping or redirecting
Ivan Radovanovic
rivanr at gmail.com
Mon Aug 10 20:40:02 UTC 2009
>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:
More information about the freebsd-bugs
mailing list