Archive for May, 2012
Say you have a config file with name=value pairs that you want to read into a script as variables. You could just “source config.properties” and let the shell execute it. That’s not very safe if you’re the least bit paranoid about what someone may have put in the config.properties. Especially if that file is also read by another program and you do not know what it might require in there.
Yeah, a config file shared by shell script and a java program. It happens.
How do we safely read in just the name=value pairs we care about?