in reply to Get My Own Name
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. | |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Get My Own Name
by EvdB (Deacon) on Feb 04, 2004 at 16:42 UTC | |
|
Re: Re: Get My Own Name
by halley (Prior) on Feb 05, 2004 at 14:49 UTC |