Reputation: 189
I need to run more than one command in bash without waiting to finishing first one and starting other command. The commands can be like this inside bash file.
#!/bin/bash
perl test.pl -i file1 -o out1
perl test.pl -i file2 -o out2
and so on
All should run at the same time in different cores instead of running one after another.
Upvotes: 0
Views: 209
Reputation: 146
Background them with &
:
#!/bin/bash
perl test.pl -i file1 -o out1 &
perl test.pl -i file2 -o out2 &
Or better yet, use GNU parallel. This will allow you to use multiple CPUs and lots more.
Upvotes: 2