O'Reilly logo

RSpec Essentials by Mani Tadayon

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

A better configuration manager

First, we'll use a script that does one simple thing. It reads the config file, validates its format, and outputs its contents without any blank lines or comments. The script is significantly more complex than the little snippet we had before, although we're only adding a few modest features. This is a common pattern which should be carefully considered: adding a couple of small features results in a very large increase in complexity. In this case, the added complexity is justified, but we shouldn't make the decision lightly.

The script is called env-echo.sh and here is what it contains:

#!/usr/bin/env bash # Echoes environment variables from a file # -- ignores comment lines # -- ignores blank lines # -- validates ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required