Yep. At first blush if you use $0 that will give you the name of the script being executed. But be careful. Let me show you a few case studies.
If I invoke it as#!/usr/bin/perl -w print $0,"\n";
sure enough it prints testzero.pl to stdout. Let's add a wrinkle! If I execute it as perl /home/peter/testzero.pl then then entire path name will be printed to stdout.perl testzero.pl
will yield ./testzero.pl to stdout and so forth../testzero.pl
In summary, hes you can get the path name of the script being executed but make sure you understand all of the implications.
| Peter L. Berghold -- Unix Professional Peter at Berghold dot Net | |
| Dog trainer, dog agility exhibitor, brewer of fine Belgian style ales. Happiness is a warm, tired, contented dog curled up at your side and a good Belgian ale in your chalice. | |
In reply to Re: Get My Own Name
by blue_cowdawg
in thread Get My Own Name
by peschkaj
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |