Sometimes, for testing purposes, you may need to pretend you have more processes named, e.g., ntpd than you actually do. In my case, I was testing a cfengine policy that should kill all processes named ntpd if they are more than one, and then start a new ntpd from a clean state.
Doing that in perl is very easy. In fact, not only the $0 variable holds the name of the process, but it works also the other way round: if you assign $0, it will change the process name in the system's process table.
So, to fake an ntpd process, you can create a perl script called ntpd like this one:
#!/usr/bin/perl $0 = q{ntpd} ; sleep 600 ;
and you run it.
This trick allowed me to test if my policy worked as expected (it did, by the way š
Can you do it with a one-liner? Of course you can:
perl -e '$0="ntpd" ; sleep 600'
Enjoy!