Strict Error Settings

github logo ・1 min read

I recently revisited an old project and tried to get it up and running. First thing I noticed is that I'm providing the user terrible error messages because even I couldn't tell what was going on. Second thing I noticed was that I didn't follow best practices for writing bash scripts. I was being too lenient with errors and steamrolling over real issues instead of stopping at the first sign of trouble. Lesson for anyone that reads this is to always have the following in any bash script

#!/bin/bash -eu
set -o pipefail
# Rest of the script

Trust me, it will save you a lot of headache down the line.

twitter logo DISCUSS (5)
Classic DEV Post from Mar 11

Enforcing Single Responsibility Principle in Python

Single Responsibility Principle (or SRP) is one of the most important concepts in software development. The main idea of this concept is: all pieces of software must have only a single responsibility.

david karapetyan profile image
Dispassionate problem solver. I enjoy building minimal and efficient systems. I like to think I don't drink the kool-aid