From 5fb83a0a33f8c30c83484b06d2e4d9d633c255cd Mon Sep 17 00:00:00 2001 From: Bob Ball Date: Tue, 29 Jul 2014 13:40:57 +0100 Subject: [PATCH] XenAPI: Fix declare definition Some versions of bash do not initialise a variable with declare -a therefore with set -u bash can terminate the script. Be more verbose in declaring the array if it is not set Change-Id: I6ec2b6e986aeffe539a2ab93432fa7af9e5a4f5d --- tools/xen/scripts/on_exit.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/xen/scripts/on_exit.sh b/tools/xen/scripts/on_exit.sh index 2441e3d84a..2846dc42d0 100755 --- a/tools/xen/scripts/on_exit.sh +++ b/tools/xen/scripts/on_exit.sh @@ -3,7 +3,9 @@ set -e set -o xtrace -declare -a on_exit_hooks +if [ -z "${on_exit_hooks:-}" ]; then + on_exit_hooks=() +fi on_exit() {