1

I have this bash script

# a.sh

name="Hello"
echo $name

How can I execute multiple times a.sh asynchronously?

1
  • 1
    You can add &: ./a.sh & Commented Apr 20, 2020 at 12:09

1 Answer 1

2

You can use a Bash range expansion and for loop to conveniently express the multiplicity, and the & operator to put the script executions in the background:

for x in {1..8}; do
    bash /path/to/a.sh &
done
Sign up to request clarification or add additional context in comments.

2 Comments

Can I achieve this in a line?
self answer: for x in {1..8}; do bash /path/to/a.sh & done

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.