Starting a script

Discussion in 'Perl Misc' started by Olivier, Jan 11, 2004.

  1. Olivier

    Olivier Guest

    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
     
    Olivier, Jan 11, 2004
    #1
    1. Advertising

  2. Olivier

    Tony Curtis Guest

    >> On Sun, 11 Jan 2004 22:12:51 +0100,
    >> "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.


    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
     
    Tony Curtis, Jan 11, 2004
    #2
    1. Advertising

  3. Olivier

    gnari Guest

    "Olivier" <> wrote in message
    news:4001bc4e$0$7155$...
    >
    > 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
     
    gnari, Jan 11, 2004
    #3
  4. Olivier

    Bob Walton Guest

    Olivier wrote:

    > 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.


    --
    Bob Walton
    Email: http://bwalton.com/cgi-bin/emailbob.pl
     
    Bob Walton, Jan 11, 2004
    #4
  5. Olivier

    Robin Guest

    "Olivier" <> wrote in message
    news:4001bc4e$0$7155$...
    > 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...


    --
    peace,
    Robin
    --------------

    Please CC a copy of your message to me.
    --------------
     
    Robin, Jan 13, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve Richter

    script debugger not starting

    Steve Richter, Apr 14, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    528
    Steve Richter
    Apr 14, 2005
  2. David Klaffenbach

    Starting a script interactively?

    David Klaffenbach, Jan 2, 2004, in forum: Python
    Replies:
    6
    Views:
    1,428
    Lonnie Princehouse
    Jan 7, 2004
  3. Greeshma
    Replies:
    0
    Views:
    353
    Greeshma
    Feb 25, 2004
  4. Greeshma
    Replies:
    1
    Views:
    495
  5. tatamata
    Replies:
    7
    Views:
    12,638
    fabiodoo
    May 28, 2008
Loading...

Share This Page