I am on Mac, and I need to execute this python program 5 times at the same time while giving each of them a parameter like this.
python program.py instance-1
python program.py instance-2
python program.py instance-3
python program.py instance-4
python program.py instance-5
I am thinking I should do this asynchronously, so I do this from a .sh file.
#!/bin/zsh
for i in {1..5}
python program.py instance-$i &
done
I think the ampersand (&) makes it async but now it only works in the background? Meanwhile I want to see the output in my terminal. How do I achieve this? I already tried the following and it also doesn’t work.
#!/bin/zsh
for i in {1..5}
python program.py instance-$i | tee /dev/tty &
done
wait
Does anyone have any idea? I am not exactly familiar with bash command in general. Also, I think it’s zsh but I am not sure if there is any difference.