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!

"not found" error is coming eventhough the file is present.why??

Status
Not open for further replies.

Bhavani2007

Programmer
Jul 24, 2007
5
0
0
IN
Hi,

not found exception is coming when i run the perl file on unix machine even though the file is there.and i have the permissions to run.
The error is :

/llo/reports/addsamp> addsamp.pl
su: addsamp.pl: not found.

Why it is coming..??? any idea...
 
We'll need to see the code of addsamp.pl which reads the file.

--
-- Ghodmode

Give a man a fish and he'll come back to buy more... Teach a man to fish and you're out of business.
 
I remove all the code from addsamp.pl and just I put one print statement.Eventhough I am getting same error.

The code is:

#!/usr/local/bin/perl
print "I am inside of perl";
 
I think that bash is having a problem with your shebang line (#!). I've made this mistake many times before. Make sure that your perl command is actually in /usr/local/bin.

Mine is in /usr/bin and I'll bet that yours is, too:
Code:
@home:~/dev$ which perl
/usr/bin/perl

Also, to verify the test, you can execute your script as an argument to the perl command. i.e.: [tt]perl addsamp.pl[/tt] This should allow perl to execute the script without even looking at the first shebang line.

--
-- Ghodmode

Give a man a fish and he'll come back to buy more... Teach a man to fish and you're out of business.
 
try
perl $filename.pl
if that works
try
./$filename.pl

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those Who Say It Cannot Be Done Are Usually Interrupted by Someone Else Doing It; Give the wrong symptoms, get the wrong solutions;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top