29 Sep
2011
29 Sep
'11
5:22 p.m.
On Fri, Sep 30, 2011 at 1:14 AM, lolilolicon <lolilolicon@gmail.com> wrote:
+# parse value of simple, non-repeating variable assignment +conf_var_val() { + local var=${1//\//\\/} + awk ' + /^[ \t]*'"${var}"'[ \t]*=/ { + sub(/[^=]+=[ \t]*/, "") + sub(/[ \t]*$/, "") + print + exit + }' +} + +DBPath=$(conf_var_val DBPath < @sysconfdir@/pacman.conf)
Mind you, my awk-fu is currently weak. You probably find this lame, please do tell. I particularly feel uncomfortble with the ${var} in there, but I don't know how you can do that with `awk -v var="$1"`.