Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 03-14-2003, 07:46 PM   #1
LQ Newbie
Registered: Mar 2003
Posts: 2

Rep: Reputation: 0
Unhappy Linux won't recognize shebang line

I was hoping someone could help me with a strange situation:

I have a Red Hat Linux 8 installation, all the standard stuff, including perl and am using the bash shell.

I wrote the standard "Hello World" Perl program and attempted to execute it with the command:

The shell replies:
-bash: command not found

The shebang line at the top of the program says:

And the command: which perl tells me:

The file permissions are: -rwxrwxr-x

The programs does run correctly with the command:
> perl

I have also used hexdump to look at and ensure that it has only newlines (\n) at the end of the lines and not any extraneous carriage returns (\r).

I hope that is enough info to show that I have investigated all the ordinary things that go wrong, but I am still stumped.

BTW: I have also tried running this under bash2, csh and sh ... with the same results. This happens with any .pl or .cgi programs I try to run. All the programs I have also tested on other Unix systems and they run fine.

Please help if you can. Thanks.
Old 03-14-2003, 09:35 PM   #2
Senior Member
Registered: Mar 2003
Distribution: Fedora
Posts: 3,658

Rep: Reputation: 69
If you're in the same directory as the file then run it using:
Perl should then do the rest!
Old 03-15-2003, 10:33 AM   #3
LQ Newbie
Registered: Mar 2003
Posts: 2

Original Poster
Rep: Reputation: 0
Thumbs up

Thank you Capt_Caveman! That did it.

Oh the explicitness of it all! I'd always heard that one of Linux' strengths was that fact that it was so highly configurable. Apparently that extends to where it looks for a command you tell it to run.

I have added .: to my path in .bash_profile and Perl is a happy camper again!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Konqueror 'magic'/'shebang' lines. richardh1970 Linux - Software 0 11-15-2005 06:57 AM
how to recognize a multiple line comment ? cyu021 Programming 2 04-07-2005 09:44 AM
Win XP Install Overwrites MBR and Linux Rescue Fails to Recognize Linux Partitions carrlane Linux - Software 8 01-14-2004 07:49 AM
linux scripting help needed read from file line by line exc commands each line read atokad Programming 4 12-26-2003 10:24 PM
My linux won't recognize commands jpflager Linux - Software 3 02-19-2003 06:12 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:53 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration