From 3640af684fb042d9443cfc15cfa4fa59c2129366 Mon Sep 17 00:00:00 2001 From: Jason Mehring Date: Sun, 2 Aug 2015 18:27:27 -0400 Subject: [PATCH] functions.sh: fix GLOBAL_CACHE error whay array does not yet exist --- functions.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions.sh b/functions.sh index e4c2d27..9d38a84 100755 --- a/functions.sh +++ b/functions.sh @@ -167,7 +167,7 @@ error() { setArrayAsGlobal() { local array="$1" local export_as="$2" - local code=$(declare -p "$array") + local code=$(declare -p "$array" 2> /dev/null || true) local replaced="${code/$array/$export_as}" eval ${replaced/declare -/declare -g} } @@ -407,7 +407,7 @@ getFileLocations() { local function="templateFile" unset GLOBAL_CACHE - declare -A -g GLOBAL_CACHE + declare -gA GLOBAL_CACHE callTemplateFunction "${filename}" "${suffix}" "${function}" setArrayAsGlobal GLOBAL_CACHE $return_global_var