Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I want to run multiple bash scripts in parallel.
example of my script running : ./test1.sh $1 and ./test2.sh $1
./test1.sh $1
./test2.sh $1
I tried this: parallel ::: "~/path/test1.sh $1" "~/path/test2.sh $1"
parallel ::: "~/path/test1.sh $1" "~/path/test2.sh $1"
Not working properly, any idea how to fix this?
You could use xargs: echo "~/path/test1.sh $1 ~/path/test2.sh $1" | xargs -P0 -n2 /bin/bash
xargs
echo "~/path/test1.sh $1 ~/path/test2.sh $1" | xargs -P0 -n2 /bin/bash
-P0 says "run all in parallel" -n2 passes two arguments to /bin/bash, in this case the script and the parameter
-P0
-n2
/bin/bash
Add a comment
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.