×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Problem Running Script

Problem Running Script

Problem Running Script

(OP)
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
 

RE: Problem Running Script

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.

RE: Problem Running Script

(OP)
Yes the directory is in the PATH.

RE: Problem Running Script

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.

RE: Problem Running Script

(OP)
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.

RE: Problem Running Script

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.

RE: Problem Running Script

(OP)
Ken,

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

Cheers,
Dave

RE: Problem Running Script

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.

RE: Problem Running Script

(OP)
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

RE: Problem Running Script

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close