Execute shell script from a perl script

Discussion in 'Perl Misc' started by kderaedt, Jun 26, 2003.

  1. kderaedt

    kderaedt Guest

    Hi,

    How can I executed a Unix shell script from a Perl script.
    The shell script is a dump of a oracle table to a file. The perl script is
    for the reformat of this output file.

    Thanks

    Karel
     
    kderaedt, Jun 26, 2003
    #1
    1. Advertising

  2. kderaedt

    J. Gleixner Guest

    J. Gleixner wrote:
    > kderaedt wrote:
    >
    >> Hi,
    >>
    >> How can I executed a Unix shell script from a Perl script.
    >> The shell script is a dump of a oracle table to a file. The perl
    >> script is
    >> for the reformat of this output file.

    >
    > perldoc -f system
    >


    Or if your perl script takes input from STDIN, and you modified your
    shell script to echo to STDOUT, no need to call system, it'd simply be:

    script.pl < script.sh > formatted.out
     
    J. Gleixner, Jun 26, 2003
    #2
    1. Advertising

  3. J. Gleixner <> wrote:
    > Or if your perl script takes input from STDIN, and you modified your
    > shell script to echo to STDOUT, no need to call system, it'd simply be:
    >
    > script.pl < script.sh > formatted.out


    You mean:
    script.sh | script.pl > formatted.out


    --
    Glenn Jackman
     
    Glenn Jackman, Jun 26, 2003
    #3
  4. "kderaedt" <> wrote in message news:<3efafb0e$0$1064$>...
    > Hi,
    >
    > How can I executed a Unix shell script from a Perl script.
    > The shell script is a dump of a oracle table to a file. The perl script is
    > for the reformat of this output file.
    >
    > Thanks
    >
    > Karel


    Hi Karel,
    you can try using a system, exec or backticks.

    Here is the documentation for those:
    http://www.perldoc.com/perl5.6/pod/func/system.html
    http://www.perldoc.com/perl5.6/pod/perlop.html#

    Hope that helps.

    Regards,
    -Andres Monroy-Hernandez
     
    Andres Monroy-Hernandez, Jun 26, 2003
    #4
    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. spec
    Replies:
    7
    Views:
    75,368
    Cameron Laird
    Jul 18, 2006
  2. Petterson Mikael

    Execute another perl script from my perl script

    Petterson Mikael, Jan 5, 2005, in forum: Perl Misc
    Replies:
    3
    Views:
    153
    Paul Lalli
    Jan 5, 2005
  3. Replies:
    20
    Views:
    871
    Gunnar Hjalmarsson
    Jan 18, 2005
  4. Replies:
    3
    Views:
    763
    alpha_beta_release
    Aug 24, 2006
  5. moongeegee

    execute a shell script in a shell script

    moongeegee, Dec 3, 2007, in forum: Perl Misc
    Replies:
    2
    Views:
    276
    Ben Morrow
    Dec 4, 2007
Loading...

Share This Page