[Omaha.pm] $0 = "I am not running";

Jay Hannah jay at jays.net
Wed Aug 27 11:55:02 PDT 2008


Fascinating. When you set $0 inside a running Perl program, "ps w"  
and "ps -ef" and some others will report whatever you set. But "ps"  
won't change...

j


$ perl -e '$0 = "I am not running"; sleep 10' &
$ ps
   PID TTY          TIME CMD
11323 pts/0    00:00:00 bash
11631 pts/0    00:00:00 perl
11656 pts/0    00:00:00 ps
$ ps w
   PID TTY      STAT   TIME COMMAND
11323 pts/0    S      0:00 -bash
11631 pts/0    S      0:00 I am not running
11657 pts/0    R+     0:00 ps w




More information about the Omaha-pm mailing list