Nuacht

Bash might be the answer to your problems. The scripting language carries a lot of power in what it can let you do since it has access to all the functions of the Unix terminal.
The most arcane shell commands and options are explained with plenty of examples. “Here” documents, a way to feed input to a script or command within the script itself, are explained thoroughly.
Shell scripting is one of those skills that are absolutely invaluable on especially UNIX and BSD-based systems like the BSDs, the two zillion Linux distributions as well as MacOS. Yet not every ...
It's not hard to create and run a shell script in Linux distros like Ubuntu, but there are a few non-obvious pitfalls you need to avoid. Here's a quick example of how to execute a script in Linux.