From 99653cd8d766cabaed2b1f2628e0b041fc0837c8 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sun, 3 Feb 2008 23:38:22 +0100 Subject: [PATCH] Decreased the amount of shell magic in override-vars. --- bin/lib | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/bin/lib b/bin/lib index 981b010..2e9ed7e 100644 --- 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 } -- 2.39.2