gsheehey has asked for the wisdom of the Perl Monks concerning the following question:

Hello Perl Monks, I am trying to run a Unix ksh script from my perl script. What I find happening is that the perl program is interpeting the ksh script as a perl script and is failing. Can some one help me with this one. Here is an example of what I am doing: ` . ksh build.ksh `; or this system (". ksh build.ksh ");

Replies are listed 'Best First'.
Re: Unix Shell Scripts
by tachyon (Chancellor) on Feb 25, 2004 at 17:39 UTC
    `/bin/ksh /path/to/script.ksh` or system( '/bin/ksh /path/to/script.ksh')

    cheers

    tachyon

Re: Unix Shell Scripts
by arden (Curate) on Feb 25, 2004 at 17:46 UTC
    gsheehey, the period before ksh is what is killing you here. As b10m said, if you have your she-bang (#!/usr/local/bin/ksh for example) set right, you can just call the script (system('build.ksh'); if it's in your path, otherwise system('/home/gsheehey/build.ksh');), if not, you'll need to call ksh first (same thing about the path).
Re: Unix Shell Scripts
by b10m (Vicar) on Feb 25, 2004 at 17:40 UTC
    "Here is an example of what I am doing: ` . ksh build.ksh `; or this system (". ksh build.ksh ");

    I'd say, just make sure your hashbang in build.ksh points out to your `ksh` shell binary and try it like this:

    system('/path/to/build.ksh');
    --
    b10m

    All code is usually tested, but rarely trusted.