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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with "./myscript.pl" but "perl myscript.pl" works f

Status
Not open for further replies.

lpezet

Programmer
Jan 14, 2005
3
US
Hi,

I have some .pl scripts on Linux (Fedora 3, Perl v5.8.5) which USED TO run fine this way (scripts having #!/usr/bin/perl):
./myscript.pl

After a reboot, I can't run them anymore the same way.
I have to do:
perl myscript.pl

Doing so, the script runs fine (so the script is correct, I even tested the -w parameter but no warnings).
It also occurs in CGI scripts (bugzilla can't work anymore....can't even submit this bug :D )

I did some tests (running ./myscript.pl) and basic stuff seems to work fine like printf(".."), system("ls").
However, a system("groupadd ...") (or system("pw groupadd ...")) don't work.


Please HEEEEEEELLLLLLLLLPPPPPPP !!!
Thank you.

PS: My knowledge is VERY VERY basic in perl.
 
Correction:
"I did some tests (running ./myscript.pl) and basic ..."
-->
"I did some tests (running ./myscript.pl AND perl myscript.pl) and basic ..."

 
Is the execute permission set on myscript.pl?
Code:
 chmod +x myscript.pl
as when you run it using perl -W myscript.pl it runs OK without, but with ./myscript.pl the flag must be set for it to work.

Also, I see you are using ./mys... so the current directory isn't in your path. Many users have the current directory appended to their path, but root doesn't, for obvious reasons. You aren't running it as root, perhaps?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top