2 ms·
I'm not convinced about having shell scripts end with ".sh" as you may be writing a simple command style script and shouldn't have to know or worry about what l
by ndsipa_pomu 4y ago
I'm not convinced about having shell scripts end with ".sh" as you may be writing a simple command style script and shouldn't have to know or worry about what language it's using.
I'm a fan of using BASH3 boilerplate: https://bash3boilerplate.sh/ https://bash3boilerplate.sh/
It's standalone, so you just start a script using it as a template and delete bits that you don't want. To my mind, the best feature is having consistent logging functions, so you're encouraged to put in lots of debug commands to output variable contents and when you change LOG_LEVEL, all the extraneous info doesn't get shown so there's no need to remove debug statements at all.
The other advantage is the option parsing, although I don't like the way that options have to have a short option (e.g. -a) - I'd prefer to just use long options.
- linsomniac 4y agoTIL about bash3boilerplate, thanks! Going to check it out.
- nathan_f77 4y agoThis is fantastic! I'm going to start using this as the baee for all my scripts, and will also start using shellcheck (on CI as well.)
- ndsipa_pomu 4y agoIt makes things so much easier. I end up putting in loads of debug statements as I'm writing the script and it just saves time in the long run.