Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

running perlscript from shell script

by keralaqueen234 (Initiate)
on May 06, 2013 at 11:02 UTC ( [id://1032243]=perlquestion: print w/replies, xml ) Need Help??

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

hi ,

i have a requirement wherein i have 3 perlscripts say 1.pl,2.pl and 3.pl. i need to execute these three pearl scripts from inside a shell script, by passing arguments. example would be like , i have a shellscript named shellscript.sh .inside this shell script i have called the 3 perlscripts . So on executing the shellscript (by passing arguments shellscript.sh arg1 arg2, it should execute the 3 perl scrits called inside. these 3 perlscripts also need the passed arguments . in short if i call shellscripts.sh arg1 arg 2, this inturn calls 1.pl arg1 arg2, 2.pl arg1 arg2, 3.pl arg1 arg2 . how to do ths? </p

Replies are listed 'Best First'.
Re: running perlscript from shell script
by choroba (Cardinal) on May 06, 2013 at 11:18 UTC
    This is not a Perl question, it is a shell question. The answer depends on what kind of shell you run; but usually, the following should work:
    1.pl "$@" 2.pl "$@" 3.pl "$@"

    "$@" stands for "all the arguments".

    If only particular arguments are needed, you can use the positional arguments:

    4.pl "$2" # Only the second argument.
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
Re: running perlscript from shell script
by zwon (Abbot) on May 06, 2013 at 11:21 UTC
    sh, check the "special parameters" section.
Re: running perlscript from shell script
by Anonymous Monk on May 07, 2013 at 01:21 UTC

    Hi,

    For me the real question is - why are you running a shell script at all?

    And why 3 Perl progs?

    You are passing the same args into all the progs. Why not just pass them into one prog and do all the work of the three progs in one go?

    I would give it a bit more thought.

    J.C.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-04-19 12:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found