Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

problems calling bash script

by incognito129 (Acolyte)
on Mar 23, 2009 at 05:46 UTC ( #752511=perlquestion: print w/replies, xml ) Need Help??

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

I am running a perl script which calls a bash script which does various things. The problem is the bash script doesn't run properly when called with a perl script. It runs fine when I run it manually at the command prompt. Is there something i'm missing here?

Replies are listed 'Best First'.
Re: problems calling bash script
by cdarke (Prior) on Mar 23, 2009 at 08:49 UTC
    What does doesn't run properly mean?

    Is that the same as "didn't run at all"?
    Was there an error message?
    Did you check $?
    Was the output different to that expected?

    It is generally easier/possible to determine the solution when we know what the problem is.
Re: problems calling bash script
by irah (Pilgrim) on Mar 23, 2009 at 05:51 UTC

      Did you give execute permission (755) for that script?
      Did you execute using backtick(`)?

      im using backtick and permissions are correct. I just tested using the system command and it runs fine but i need the output.

        Both the script are working fine for me. The bash script contains,

        #!/bin/bash echo `date`;

        The Perl script contains,

        #!/usr/bin/perl use strict; use warnings; print `./bash_script`;

        You can take this as sample and continue the process. You may forget to mention the path.

Re: problems calling bash script
by targetsmart (Curate) on Mar 23, 2009 at 07:04 UTC
    Let us know on what you want to achieve using that bash script, because perl is inspired by C, SED and shell(unix shells). Perl itself can help you without using bash script.
    but if you are writing a wrapper in perl to call lot of bash scripts then your idea is okay.
    give us some more details about the aim of your perl program and bash script to help you.

    Vivek
    -- In accordance with the prarabdha of each, the One whose function it is to ordain makes each to act. What will not happen will never happen, whatever effort one may put forth. And what will happen will not fail to happen, however much one may seek to prevent it. This is certain. The part of wisdom therefore is to stay quiet.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://752511]
Approved by planetscape
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2021-11-27 21:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?