中文 English

How to Run Multiple Python Scripts on Mac with One Command

Published: 2021-02-25
mac command terminal python

There are currently 4 Python scripts, and I want to execute all 4 scripts with a single command. How can I do that? My current approach is rather crude. I used 5 shell scripts to achieve it, but I don’t know whether there is a better way.

shell script runAll.sh

#!/bin/bash
ls
open -a Terminal.app run17688821.sh
open -a Terminal.app run49763693.sh
open -a Terminal.app run857413.sh
open -a Terminal.app run856853.sh

shell script run17688821.sh

#!/bin/bash
cd  ~/CodesTemp/yzf99-50/
python3 yzf_17688821.py

shell script run49763693.sh

#!/bin/bash
cd  ~/CodesTemp/yzf99-50/
python3 yzf_49763693.py

shell script run857413.sh

#!/bin/bash
cd  ~/CodesTemp/yzf99-50/
python3 yzf_857413.py

shell script run856853.sh

#!/bin/bash
cd  ~/CodesTemp/yzf99-50/
python3 yzf_856853.py

Reference

https://stackoverflow.com/questions/989349/running-a-command-in-a-new-mac-os-x-terminal-window