Browse code

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

Bob Ball authored on 2014/07/29 21:40:57
Showing 1 changed files
... ...
@@ -3,7 +3,9 @@
3 3
 set -e
4 4
 set -o xtrace
5 5
 
6
-declare -a on_exit_hooks
6
+if [ -z "${on_exit_hooks:-}" ]; then
7
+    on_exit_hooks=()
8
+fi
7 9
 
8 10
 on_exit()
9 11
 {