0

I have written a bash script which inturn needs to run around 130 Perl scripts.

#!/bin/bash
perl file1.pl &
perl file2.pl &
perl file3.pl &
....
....
perl file130.pl &

The above bash script is configured in the cron to run after every 10 minutes. Is there any other way in which we can run all these 130+ perl scripts at a time ?

2 Answers2

3
for script in file*.pl
do
  perl "$script" &
done
Ignacio Vazquez-Abrams
  • 45,939
  • 6
  • 79
  • 84
3

If the scripts are actually named like that:

#!/bin/bash
for i in {1..130}
do
    perl "file$i.pl" &
done
Dennis Williamson
  • 62,149
  • 16
  • 116
  • 151