I've never done this before, but I believe makefiles are the way forward:
A Makefile consists of a set of rules. A rule generally looks like this:
targets : prerequisities
command
command
command
The targets are file names, separated by spaces. Typically, there is only one per rule.
The commands are a series of steps typically used to make the target(s). These need to start with a tab character, not spaces. The prerequisites are also file names, separated by spaces. These files need to exist before the commands for the target are run.
So let's assume you want to run 5 commands: cmd1, cmd2, cmd3, cmd4, cmd5. Assume the following dependencies:
cmd1 and cmd3 have no dependencies
cmd2 depends on output from cmd1 and cmd4
cmd4 depends on the output of cmd1
cmd5 depends on output of cmd4 and cmd3.
In this case, the Makefile would look like:
all: cmd1.run cmd2.run cmd3.run cmd4.run cmd5.run
cmd1.run :
cmd1
touch cmd1.run
cmd2.run : cmd1.run cmd4.run
cmd2
touch cmd2.run
cmd3.run :
cmd3
touch cmd3.run
cmd4.run : cmd1.run
cmd4
touch cmd4.run
cmd5.run : cmd3.run cmd4.run
cmd5
touch cmd5.run
Now you can just run your scripts with the simple command:
$ make
More details on the hocus-pocus: https://makefiletutorial.com/
make -j4or someting like that.