Starting a script

O

Olivier

J've got a little problem and I don't find the solution.

If I launch a script with the command-line, like perl -e 'print"toto\n";',
perl execute the command and give me the result.

But, if I write a script that is launched with perl mon_script, nothing
happen. More, if I write #!/usr/bin/perl on the firt line of the script,
nothing is done.

I'm using perl 5.8.1 on a Mandrake Linux 9.2.

Does anyone have an idea to help me ?

Thanks, Olivier
 
T

Tony Curtis

J've got a little problem and I don't find the solution. If
I launch a script with the command-line, like perl -e
'print"toto\n";', perl execute the command and give me the
result.
But, if I write a script that is launched with perl
mon_script, nothing happen. More, if I write #!/usr/bin/perl
on the firt line of the script, nothing is done.
I'm using perl 5.8.1 on a Mandrake Linux 9.2.

Show a small sample program that displays this behaviour, and
a capture of the shell as you display and run the program.

Then we'll have something concrete to ask further questions
about.

Also, what do you get from these commands?

perl -V

which perl

type -a perl

hth
t
 
G

gnari

Olivier said:
If I launch a script with the command-line, like perl -e 'print"toto\n";',
perl execute the command and give me the result.

But, if I write a script that is launched with perl mon_script, nothing
happen.

define 'nothing'.

probably your perl script 'mon_script' does 'nothing'

make the simplest script you can think of that proves
your point, and show us:
a) the script (do 'cat mon_script')
b) how you run it
c) what happens
d) what you think should have happened

a), b) and c) preferably aquired with cut and paste

gnari
 
B

Bob Walton

Olivier said:
J've got a little problem and I don't find the solution.

If I launch a script with the command-line, like perl -e 'print"toto\n";',
perl execute the command and give me the result.

But, if I write a script that is launched with perl mon_script, nothing
happen. More, if I write #!/usr/bin/perl on the firt line of the script,
nothing is done.

I'm using perl 5.8.1 on a Mandrake Linux 9.2.
....


Hmmmmm...is your Perl binary located at /usr/bin/perl or somewhere else?
Does the file in which your Perl script resides have its execute
permission set? When you say "nothing happen" and "nothing is done",
what *exactly* do you mean? Does the computer crash? Does it hang
forever? Give another shell prompt? Give an error message? If the
latter, what *exactly* does it say?

One other point: Was the Perl script written using a *nix editor? If
it was generated by a Windoze editor, it may have a CR-LF at the end of
the #!/usr/bin/perl line. Some (most? all?) flavors of *nix are not
happy with that -- they require just a LF at the end of the
#!/usr/bin/perl line (note: it is the *nix kernel which requires that,
not Perl). The symptom you describe will occur if the line terminator
on that line is CR-LF.
 
R

Robin

Olivier said:
J've got a little problem and I don't find the solution.

If I launch a script with the command-line, like perl -e 'print"toto\n";',
perl execute the command and give me the result.

try chmod 755 on the script and then run it as an executable without perl,
not that that'll fix it. You might also want to find out where perl is on
your system with which...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top