The first thing you might be thinking is what does msu
stand for? It stands for my shell utilities. I started the project as a library of functions and constants that I could re-use when writing bash scripts. This went on until I realized that I had to keep writing out the structure of the scripts.
Is it a framework? Yeah! Using the core and ecosystem of msu
, you can write a bash script faster. You write it as a module and msu
takes care of checking the dependencies and running it. You get to re-use common functions in any of your modules without having to copy-paste them. Yes, it is a small Shell framework.
What are the benefits?
- use other developers’ modules; do not re-invent the wheel
- common functions can be re-used freely, without copy-paste!
- these common functions can be developed and tested independently
show me how it works
Install msu
:
⇒ wget -qO- http://git.io/vTE0s | bash
Install the module Submarine for some submarines:
⇒ msu install gh:GochoMugo/submarine
Write a module, my-module.sh
, to install a node module from npmjs.org globally*, i.e. ${HOME}/node_modules
is simple:
msu_require console # internal module for logging to console
msu_require submarine.npm # external module for submarines :-)
# install the module fancily
function install() {
log "install module globally" # `log` is from module `console`
g ${1} # `g` is from module `submarine.npm`. It installs node modules globally
log "done!!!"
}
Install this module into msu
:
⇒ msu install my-module.sh
Running this function, does not even require you to make the script executable, you simply run:
⇒ msu run my-module.install "express"
conclusion
msu
might prove useful to programmers, especially sysadmins. It is a sword, yes!, but not so shiny yet. The project is on Github and would really love to get contributions and more ideas.
This is my first-ever blog post, any tips on improvement would be awesome!
Happy coding!