Skip to content

Instantly share code, notes, and snippets.

@syohex
Created August 6, 2012 13:11
Show Gist options
  • Save syohex/3274379 to your computer and use it in GitHub Desktop.
Save syohex/3274379 to your computer and use it in GitHub Desktop.
modify $0 kfreebsd and Linux
syohei@kfreebsdi386:~/junk/perl$ uname -a
GNU/kFreeBSD kfreebsdi386 8.1-1-686 #0 Sat Jul 21 17:02:04 UTC 2012 i686 i386 Intel(R) Core(TM) i7-2600S CPU @ 2.80GHz GNU/kFreeBSD
syohei@kfreebsdi386:~/junk/perl$ perl --version
This is perl 5, version 16, subversion 0 (v5.16.0) built for i686-gnukfreebsd
Copyright 1987-2012, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
syohei@kfreebsdi386:~/junk/perl$ cat prog_name.pl
#!perl
$0 = "hogehoge";
print `ps -p $$`;
syohei@kfreebsdi386:~/junk/perl$ perl prog_name.pl
PID TTY TIME CMD
52469 ? 00:00:00 perl
syohei@www12378ue:% uname -a [~/junk/perl]
Linux www12378ue 2.6.32-41-generic #89-Ubuntu SMP Fri Apr 27 22:22:09 UTC 2012 i686 GNU/Linux
syohei@www12378ue:% perl --version [~/junk/perl]
This is perl 5, version 16, subversion 0 (v5.16.0) built for i686-linux-thread-multi
Copyright 1987-2012, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
syohei@www12378ue:% cat prog_name.pl [~/junk/perl]
#!/usr/bin/env perl
$0 = "hoge";
print `ps -p $$`;
syohei@www12378ue:% vim prog_name.pl [~/junk/perl]
syohei@www12378ue:% perl prog_name.pl [~/junk/perl]
PID TTY TIME CMD
849 pts/0 00:00:00 hoge
syohei@www12378ue:% vim prog_name.pl [~/junk/perl]
syohei@www12378ue:% perl prog_name.pl [~/junk/perl]
PID TTY TIME CMD
876 pts/0 00:00:00 hogehoge
syohei@www12378ue:%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment