0

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.

2

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.