Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Search Forums:



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 09-09-2010
Registered User
 

Join Date: Aug 2010
Posts: 20
Thanks: 1
Thanked 0 Times in 0 Posts
Wrapper Script Help With Perl Scripts

I have tried looking through wrapper scripts throughout the forum, but I don't think they were able to answer my question (either that or I'm just confused).
Basically, I have a Perl script that I want to run in parallel 4 times with parameters, wait for all of them to finish, then run another script.

Ex. perl test.pl input1.txt output1.txt &&
perl test.pl input2.txt output2.txt && ....etc.

How would I do this? Any help is greatly appreciated!
Sponsored Links
    #2  
Old 09-09-2010
Moderator
 

Join Date: Aug 2005
Location: Saskatchewan
Posts: 12,191
Thanks: 232
Thanked 1,703 Times in 1,632 Posts

Code:
#!/bin/sh

for N in 1 2 3 4
do
        perl test.pl input${N}.txt output${N}.txt &
done

wait

Sponsored Links
    #3  
Old 09-09-2010
Registered User
 

Join Date: Aug 2010
Posts: 20
Thanks: 1
Thanked 0 Times in 0 Posts
Sorry, I should've been more specific.

I would also like to run this script in a Windows environment.
Preferably, I would like to avoid using UNIX environments (ex. Cygwin) since I'll be running this in a Windows environment.
As far as I'm aware, .sh scripts don't work in Windows (unless I missed something...).

My Perl scripts all run fine; just need to get the wrapping script all set up and I'll be good to go.
    #4  
Old 09-09-2010
Resident BOFH
 

Join Date: Dec 2007
Posts: 1,100
Thanks: 2
Thanked 76 Times in 74 Posts
use Perl threads or I think Windows powershell can handle this.
Sponsored Links
    #5  
Old 09-09-2010
Registered User
 

Join Date: Aug 2010
Posts: 20
Thanks: 1
Thanked 0 Times in 0 Posts
Hmm, crud, Perl threads... I haven't done threading for a long time...
Well, if it works, then that's what I will have to refresh my memory with.
Many thanks!!
Sponsored Links
    #6  
Old 09-10-2010
pludi's Avatar
pludi pludi is offline Forum Staff  
Cat herder
 

Join Date: Dec 2008
Location: Vienna, Austria, Earth
Posts: 5,486
Thanks: 38
Thanked 324 Times in 301 Posts
Before you dive into the world of threads, how about a wrapper script written in Perl that forks and execs your programs?
Sponsored Links
    #7  
Old 09-10-2010
Resident BOFH
 

Join Date: Dec 2007
Posts: 1,100
Thanks: 2
Thanked 76 Times in 74 Posts
Quote:
Originally Posted by pludi View Post
Before you dive into the world of threads, how about a wrapper script written in Perl that forks and execs your programs?
Does fork() work on Windows?
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Count script wrapper help richsark Shell Programming and Scripting 19 05-05-2009 05:42 PM
wrapper script in perl richsark Shell Programming and Scripting 5 03-23-2009 03:41 PM
Help with a wrapper script not working richsark Shell Programming and Scripting 0 03-09-2009 12:49 PM
New wrapper script will be developed to wrap two ksh scripts ishai82 Shell Programming and Scripting 3 03-17-2008 03:45 AM
What is a wrapper script thana UNIX for Dummies Questions & Answers 1 01-28-2008 07:11 AM



All times are GMT -4. The time now is 04:14 AM.