]> mj.ucw.cz Git - eval.git/commitdiff
Decreased the amount of shell magic in override-vars.
authorMartin Mares <mj@ucw.cz>
Sun, 3 Feb 2008 22:38:22 +0000 (23:38 +0100)
committerMartin Mares <mj@ucw.cz>
Sun, 3 Feb 2008 22:38:22 +0000 (23:38 +0100)
bin/lib

diff --git a/bin/lib b/bin/lib
index 981b01002a93e3ae4544d19285786059732d5148..2e9ed7edec8bce0578b3a33fda4e8c85dd834125 100644 (file)
--- a/bin/lib
+++ b/bin/lib
@@ -53,14 +53,13 @@ function try-ln
 
 function override-vars
 {
-       local OR V OLDIFS
+       local OR V W
        declare -a OR
-       OLDIFS="$IFS"
-       IFS=$'\n'
-       OR=($(set | sed "s/^$1_//;t;d")) || true
-       IFS="$OLDIFS"
+       # `${!${1}_@}' does not work, so we have to use eval
+       OR=($(eval echo '${!'$1'_@}'))
        for V in "${OR[@]}" ; do
-               eval "$V"
+               W=${V##$1_}
+               eval $W='"$'$V'"'
        done
 }