So here's is the scenario, I have a shell script that based on a network command it execute an action, it may be a service restart or stop. That part is working fine, but I'm stucked at a part that I need to guarantee that it can be more flexible, i.e, that I can add some services later without touching the main script. So what I have in mind is to separate the script into multiple scripts, like interfaces.d/ does, but instead of a config file I want to store some code inside of it and load it when the script is called. Problem is, for each "process" I want to create a separate file with an if within it. Is that even possible?
Thnaks.
Answering my own question, actually you can do that.
What I did was iterate through the files in the .d folder and executed them with:
Note that there's a space between the dot and the file.
Hope this helps someone