[Israel.pm] using "system"

Offer Kaye offer.kaye at gmail.com
Sun Oct 31 05:54:08 PST 2004


On Sun, 31 Oct 2004 13:18:47 +0000, Mikhael Goikhman <migo at homemail.com> wrote:
> 
> I think I explained the reasons in my message. Here is one more time. :)
> 

I frequently need things explained to me more then once :-)

> Reason number one: to get fancier output in "ps" and "top".

Weird - I tried the command:
   system {"sleep"} "foo", "60";
inside a perl script which I placed in the background.
When I did "ps" or "top", I saw "sleep".
When I did "ps -Af | grep foo", I saw the same proc number, but called
foo. Actually, it was enough to do "ps -f" to see "foo" instead of
"sleep".
Strange that 2 different forms of "ps" (3 if you count "top") should
see different names for the same process. I would have thought both
would see "foo". Must be some wierdness of the shell, or the version
of ps I'm using, or something...

> 
> Reason number two: if a program itself supports several simulation modes
> depending on the way it is called (i.e. by looking at argv[0]), to be
> able to activate a specific mode by running the program directly.
> (Other possible ways to activate these modes would be by running any
> symlinks or hardlinks to that program, but these may or may not exist,
> it is more flexible to fiddle with argv[0] of that program directly.)

Ah, I see now. Very cool :-)

Thanks for the clear explanations and for the patience :-)

-- 
Offer Kaye



More information about the Perl mailing list