Monday, February 17, 2014

Bash: reading properties based on an ENV parameter

I hate bash, and I hate that there is not a standard way of reading property files based on 2 parameters: the property name, and the environment. And we are in 2014...flying people to Mars etc...and still hacking these very basic requirements.

Here is a possible solution:

create a executable file:


you have your environment name in a variable ENV


you load all your properties:

. ./  (note the space after the first . !)

then you get the property name with an "indirect referencing":


There are many other ways (I hate the cat/grep/awk solution) but they all stink just the same.
Let's face it, bash stinks. Like a skunk.

No comments: