Understanding my path and running my dumb perl programs

karavite

Registered
Hope this isn't too much a newbie question, but I don't quite get this path thing. I wrote some shell scripts and put them in my User/dean/bin (dean is my account name) directory and they run from anywhere. I wrote some simple Perl programs, put them in the same directory, but they will not run unless I am in the actual directory and type "./filename.pl"

When I check my path with $PATH, User/dean/bin is there. What, please, is going on?
 
Do you have the "#!/usr/bin/perl" as your first line in your scripts. This tells the shell what to run the script in.

Have you set the permissions correctly? You need to set the permissions on the script so that you (the owner) can execute the file. "chmod 744 script-filename " script-filename being the file you want to execute.

-j
 
thats not true at all.

the 'rehash' command updates the current shell's cache of
PATH elements.

Make sure the script is mode 755 or so (executable).
 
Well, I don't want to cause a problem here, but chmod 744 seemed to do the trick. I had been using chmod 755 (found it in my Perl book and another Unix book) with no results, even when launching a second terminal, rebooting...HOWEVER I never did a rehash.

So, in the interest of science, I just tried chmod 755 then rehash and that works too!

If you guys want to slug it out over who is right, please be nice! And thanks to all of you.

I don't have the codes handy, so what exactly does 744 vs. 755 do.
 
744 would make it readable, writeable and executable by the owner, but only readable to groups and everyone else. 755 makes it readable, writeable and executable by the owner, and readable and executable by groups and everyone else.
 
744 would make it readable, writeable and executable by the owner, but only readable to groups and everyone else. 755 makes it readable, writeable and executable by the owner, and readable and executable by groups and everyone else.

Thought so - really - thanks a lot!
 
My point was that you stated that the user had to open up
a new terminal shell in order to use a changed PATH setting and
that isn't strictly true. Also, simply changing the PATH
in the current shell wont affect others unless the change is made
to one of the startup files such as .tcshrc
 
Back
Top