[pacman-dev] [PATCH 2/6] Don't do eval
lolilolicon
lolilolicon at gmail.com
Thu Sep 29 13:22:27 EDT 2011
On Fri, Sep 30, 2011 at 1:14 AM, lolilolicon <lolilolicon at 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"`.
More information about the pacman-dev
mailing list