CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
How can I run perl script from everywhere?

 



angeloulivieri
Novice

Jul 4, 2013, 3:08 AM

Post #1 of 4 (779 views)
How can I run perl script from everywhere? Can't Post

Hi all,
I was wondering how can I start a perl script from every path in the shell by only using the string: myscript.pl?

Someone knows?

Thanks
Angelo


FishMonger
Veteran / Moderator

Jul 4, 2013, 6:57 AM

Post #2 of 4 (774 views)
Re: [angeloulivieri] How can I run perl script from everywhere? [In reply to] Can't Post

Your question is not real clear, but if by "from every path in the shell" you mean that the script could be in any one of the directories listed in your path environment, then all you need is to have the script's shebang line point to the perl interpreter and the execute bit needs to be set.

If you mean that the script could be located anywhere outside of the paths listed in the path environment, then you'll need to specify that path when executing the script.


angeloulivieri
Novice

Jul 4, 2013, 9:00 AM

Post #3 of 4 (768 views)
Re: [FishMonger] How can I run perl script from everywhere? [In reply to] Can't Post

Ok.. actually I'm using this install.pl script to do an initial configuration. It writes:

$ENV{'PATH'} = $ENV{'PATH'}.":".$myscriptDir;

so, yes, I can insert the path of my folder with myscript.pl (and other modules) inside the PATH environmental variable.
In the first line of myscript.pl there is already the path to the perl interpreter. But I don't know what did you mean with "execute bit needs to be set"




angeloulivieri
Novice

Jul 4, 2013, 9:06 AM

Post #4 of 4 (766 views)
Re: [angeloulivieri] How can I run perl script from everywhere? [In reply to] Can't Post

Ah ok! You mean the execute bit in the permissions of file access... I have to change the permissions. Ok!

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives