Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
Perl-Sensitive Sunglasses
 
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.

Comment on Running shell script which needs runtime input through perl
Download Code
Re: Running shell script which needs runtime input through perl
by roboticus (Canon) 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 (Chancellor) on Feb 02, 2012 at 14:35 UTC
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.

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 drinking their drinks and smoking their pipes about the Monastery: (13)
As of 2014-04-18 19:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (471 votes), past polls