Also if you can, can you provide the structure of running scripts?
You use multiple `curl` commands is easiest. The REST does not directly let you run "a script" – each REST operation is one command. So in a bash, you can just set some environment variables (e.g. ROUTER= USER=.
Theoretically, you could "-X PUT" to upload a long RouterOSscript using `{ "name": "myrestscript", "source": "..." }` to https://$ROUTER/rest/system/script, the "-X POST" to run it using .../system/script/run. Or, use
curl -u admin:pass -k -X POST https://$ROUTER/rest/execute --json '{"script": "/log/info test"}'
Issue is escaping between your shell and the RouterOS.... curl allows a file to be used with the JSON using "@" (see curl man page). But since any RouterOS script with " quotes have escaped. You can create the script once on the router, the use -X GET to return the JSON for the script – that would contain all the needed escaping for example. Get confusing quickly.
If you're using `curl`... the more UNIX thing to do is env variables with the ROUTER and USER (or add'l ROUTERURL="https://$ROUTER/rest/" to save more typing per command). Then add multiple calls to `curl` in a #!/bin/sh script file.
`jq` is common Linux too that helps with
getting data out of JSON at the bourne/bash/zsh shell returned from `curl`. See this post for example:
viewtopic.php?t=194105&hilit=jq#p987988