Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem Running Script

Status
Not open for further replies.

dcomit

Technical User
Jun 20, 2001
115
0
0
GB
I’m on Solaris 10

I’ve put a perl script in a directory but when I try to run it from the directory I get an error message ‘Command not found.’

If I prefix the command with ./ it runs. How do I get it to run without the prefix?

Thanks,
Dave
 
Is the directory included in your PATH (echo $PATH). If not add it to it.

The internet - allowing those who don't know what they're talking about to have their say.
 
Yes the directory is in the PATH.
 
Dave, I imagine you use a shebang perl in the script? If so, is it the fully qualified path to perl?

The internet - allowing those who don't know what they're talking about to have their say.
 
Ken,

No idea what shebang perl is! I checked for the perl location with find . -name perl -print and found it in many locations. I plumped for /usr/bin/perl

I wouldn't have thought the perl part is the problem as the error message seems to indicate the script can't be found.
 
That's why the PATH immediately sprang to mind - perhaps there's a typo or 'foreign' character in it? Maybe try exporting the full PATH again including the errant one:

export $PATH:/path/to/your/directoy

Sorry - the shebang is usually the first line of a script, telling where to find the shell/program used to run the script - like:

#!/usr/local/bin/perl

for example. Hopefully someone else will be along with some other ideas for you.

The internet - allowing those who don't know what they're talking about to have their say.
 
Ken,

Thanks for your help - at least I've learned something new today: shebang (sounds like an illegal Irish drinking den).

Cheers,
Dave
 
Feels like I was drinking in one last night! The export command above should read:

export PATH=$PATH:/path/to/your/directory

The internet - allowing those who don't know what they're talking about to have their say.
 
Ken,

Cracked it! I logged out and logged back in again. The PATH looked ok but I'd been shelling out and back in during the course of my last session so I guess things got screwed up.

Thanks again,
Dave
 
Dave - good to hear. It's often the little things that screw the whole lot up!

The internet - allowing those who don't know what they're talking about to have their say.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top