From 4d1c0e94f702267fdf1b291c3c96af5ae1d6d835 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Mon, 1 May 2017 20:21:05 +0200 Subject: [PATCH] Declare global arrays from helper functions --- .zsh/util | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.zsh/util b/.zsh/util index d3292f4..ed37cb4 100644 --- a/.zsh/util +++ b/.zsh/util @@ -16,7 +16,7 @@ array_prepend() { local arrayname="$1"; shift local i for i; do - eval "$arrayname=(\$i \${$arrayname[@]/\$i})" + eval "typeset -ga $arrayname=(\$i \${$arrayname[@]/\$i})" done } @@ -24,7 +24,7 @@ array_append() { local arrayname="$1"; shift local i for i; do - eval "$arrayname=(\${$arrayname[@]/\$i} \$i)" + eval "typeset -ga $arrayname=(\${$arrayname[@]/\$i} \$i)" done } -- 2.39.5