Conversative Updating

Easy to use

Fetch, Execute, Done

Conflict Free

Supports multiple Versions of the same Module


Manual Download

You can always get the latest static version of Module.sh from:


Just download it and save it as module.sh. To use Module.sh in your script you have to source it like that:

. ./module.sh

If you want to load it relative to your script and not relative to your current work directory you can use something like:

. "$(dirname "$(readlink -f "$0")")/module.sh"

Dynamic Script

If you want to let your script download the latest version of Module.sh during execution you can use the following snippet:

eval "$(curl -fsL "https://mdl.sh/latest")"

After that line, you can use the module command. The upside of this approach is the ease of use. The downside is that it will not work when the server fails and under certain circumstance can lead to executing some server error message (if curl doesn’t fail). So this is nice for playing around, but should not be used in production.


Other good Reasons to use Module.sh


When your Scripts become larger you often struggle with the fact that every variable name is part of the global scope (even the ones within functions). An easy fix is to use the local keyword. But did you know that local is not POSIX compliant?

Module.sh solves the issue by isolating every module within its own Sub-Shell. That way you can keep using global variable names, as global gets limited to your module.