PressPausePlay
Tuesday, May 29th, 2012
Yet another collection of random links and rantings of a greying unix geek with a photography bent. Pass the Guinness and Grecian Formula.
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?