[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

ps detects context?



I have a perl script. To make sure it is running, I do a 'ps aux' and see something like on my screen:

[amead hera amead]$ ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.1 1104 72 ? S Jul05 5:50 init [3]
...
root 22461 0.1 3.0 2840 1904 pts/1 S 13:07 0:01 perl -w /usr/sbin/sendreports
...


But if I try to pipe the output into grep looking for 'sendreports' I get nothing. If I grep for perl, I get part of the command line:

[amead hera amead]$ ps aux | grep -i sendreport
[amead hera amead]$ ps aux | grep -i perl
root 22461 0.1 3.0 2840 1904 pts/1 S 13:07 0:01 perl -w /usr/sbin
amead 22570 0.0 0.6 1164 428 pts/2 S 13:28 0:00 grep -i perl


Why does ps truncate it's output?

The -w option does give the complete width but I'm curious why the output varies between depending on whether it's going to the screen to a pipe. I sense the possibility that I could learn something here...

-Alan
---
Alan Mead, Ph.D.  /  Research Scientist  /  adm ipat com
Institute for Personality and Ability Testing
1801 Woodfield Dr  /  Savoy IL 61874 USA
217-352-4739 (v)  /  217-352-9674 (f)





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]