On Thu, Sep 29, 2011 at 12:24 PM, Dave Reisner <d...@falconindy.com> wrote: > On Fri, Sep 30, 2011 at 01:14:02AM +0800, lolilolicon wrote: >> Simply `eval'ing configurations from pacman.conf is really bad practice. >> Use proper string parsing instead. The parser implemented here aborts >> as soon as it gets the first assignment, being consistent with pacman. > > I'm not really a fan of using awk, here, either -- totally unreadable. > We've been bitten by numerous portability issues with awk in the past. > I recommend testing against mawk and nawk if you're ever going to use > awk in our codebase. Also to note bad practice: embedding shell > variables in the awk expressions. You should be defining the variable > within the program with the -v flag to awk. > > See how we do this in scripts/pacman-key in pure bash (func is > get_from() -- yes, its a terrible name). Given how frequently we seem to > do this, it might be a candidate for pulling out and maintaining a > single implementation in the scripts/library dir.
What a crazy idea! And by crazy, I mean great. This is definitely script-library eligible in my mind, so I'd rather we focus on getting the "one true way" worked out and into a file so all our scripts can benefit. -Dan