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 May 3

Formidable Labs to Start Paying for OSS Contributions

An interesting blog post came out today from Formidable Labs. As the blog title s...

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

Sore eyes?

dev.to now has dark mode.

Go to the "misc" section of your settings and select night theme ❤️