[Israel.pm] Cool usage hack which I saw in another mailing list

Omer Zak omerz at actcom.co.il
Fri Mar 4 07:02:50 PST 2005


There is a backup script at
http://www.sanitarium.net/unix_stuff/backups/diff_backup.pl.txt which is
too cool for words.

$Me="/root/bin/diff_backup.pl";
if ($ARGV[0] eq "-h" || $ARGV[0] eq "--help") {
  open (SELF, $Me);
  while (<SELF>) {
    if ($_ =~ /^#H# /) {
      $Line=$_;
      $Line =~ s/^#H# //;
      print $Line;
    }
  }
  exit;
}

The preceding is a really great idea. Why didn't everyone think of that?
Much cleaner than an ugly usage() routine.

Could you have found the location it's running from in order that it
would keep on working even if you changed the scripts location?

Credit for the script is due to Kevin Korb http://www.sanitarium.net/

-- 
My own blog is at http://www.livejournal.com/users/tddpirate/

My opinions, as expressed in this E-mail message, are mine alone.
They do not represent the official policy of any organization with which
I may be affiliated in any way.
WARNING TO SPAMMERS:  at http://www.zak.co.il/spamwarning.html




More information about the Perl mailing list