VSHN.timer

VSHN.timer #33: Shell Scripting

9. Mar 2020

Welcome to another VSHN.timer! Every Monday, 5 links related to Kubernetes, OpenShift, CI / CD, and DevOps; all stuff coming out of our own chat system, making us think, laugh, or simply work better.
This week we are going to talk about useful tips and tricks for writing shell scripts. However, given the current situation of the COVID-19 outbreak, we wanted to start this edition of VSHN.timer linking to the official recommendations for workplaces of the Swiss Federal Office of Public Health. Last week we shared in this blog our own measures, based on those guidelines. Stay safe!
1. Shell scripts are very convenient; they are portable and available off-the-box across Unixes, but they can also be tricky to write correctly. This can lead to common bugs, and most problematic, security issues, which can be particularly nasty in the age of containers. To avoid bad surprises, the MIT Student Information Processing Board has published a series of recommendations for safer shell scripts.
https://sipb.mit.edu/doc/safe-shell/


2. We have already referenced this one, but here it goes again: the ultimate Bash scripting cheatsheet. Must. Have.

3. Going a step further than a simple cheatsheet, the Unix Toolbox is an outstanding collection of Linux / Unix / BSD commands, neatly organized by topic, highlighting the major differences between Linux and BSDs. Fantastic, timeless resource.

4. If you use Ansible and need to interface with it with Python, you will most probably need Ansible Runner. Jan-Piet Mens wrote an extensive blog post showing how to use it and integrate it with other systems.
https://jpmens.net/2020/02/28/dial-a-for-ansible-and-r-for-runner/
5. The tool of the week is ShellCheck, a fantastic lint for shell scripts, featuring integration with the most popular editors. It’s like having an expert proofreading your code and pointing most common mistakes, and providing suggestions! And if you would like to learn more about how it was written, this blog post by its author will provide answers to all your questions.
https://www.shellcheck.net/
What other tools would you recommend? What programming languages do you write your scripts with? Get in touch with us through the form at the bottom of this page, and see you next week for another edition of VSHN.timer.

Adrian Kosmaczewski

Adrian Kosmaczewski is in charge of Developer Relations at VSHN. He is a software developer since 1996, a trainer, and a published author. Adrian holds a Master in Information Technology from the University of Liverpool.

Contact us

Our team of experts is available for you. In case of emergency also 24/7.

Contact us