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

Running shell script which needs runtime input through perl

by snreddy_gopu (Novice)
on Feb 02, 2012 at 13:43 UTC ( #951434=perlquestion: print w/ replies, xml ) Need Help??
snreddy_gopu has asked for the wisdom of the Perl Monks concerning the following question:

Hi all, I have one shell script which needs runtime input. I have run this script through another shell script as follows
./setup.sh << EOI a EOI

Now I want to run that setup.sh shell script through perl script instead of another shell script.

Replies are listed 'Best First'.
Re: Running shell script which needs runtime input through perl
by Eliya (Vicar) on Feb 02, 2012 at 15:01 UTC

    I think you want piped open:

    open my $fh, "| ./setup.sh" or die $!; # print $fh "$_\n" for qw(a b c ...);

    When you then say print $fh ..., the shell script gets the data on stdin, as it would from your current heredoc.

Re: Running shell script which needs runtime input through perl
by roboticus (Chancellor) on Feb 02, 2012 at 14:13 UTC

    snreddy_gopu:

    And your question is....?

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

Re: Running shell script which needs runtime input through perl
by toolic (Bishop) on Feb 02, 2012 at 14:35 UTC

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2016-06-30 15:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (396 votes). Check out past polls.