diff options
author | Reto Buerki <reet@codelabs.ch> | 2012-12-09 10:50:28 +0100 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2013-01-17 16:54:54 +0100 |
commit | 74c0839ad6e0da6f299b65ed39fe2f21fa19caf9 (patch) | |
tree | a39ccf0d0be7d6198f13d455af71cdbc63caad94 /testing/scripts/function.sh | |
parent | 97265abaf0265d0cc59fb1be02e3239fca3daae3 (diff) | |
download | strongswan-74c0839ad6e0da6f299b65ed39fe2f21fa19caf9.tar.bz2 strongswan-74c0839ad6e0da6f299b65ed39fe2f21fa19caf9.tar.xz |
Run on_exit commands in FILO order
Diffstat (limited to 'testing/scripts/function.sh')
-rwxr-xr-x | testing/scripts/function.sh | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/testing/scripts/function.sh b/testing/scripts/function.sh index 2a801a7a5..649e32b65 100755 --- a/testing/scripts/function.sh +++ b/testing/scripts/function.sh @@ -97,16 +97,17 @@ declare -a on_exit_items # perform registered actions on exit on_exit() { - for i in "${on_exit_items[@]}" + for ((onex=${#on_exit_items[@]}-1; onex>=0; onex--)) do - eval $i >>$LOGFILE 2>&1 + echo "On_Exit: ${on_exit_items[$onex]}" >>$LOGFILE + ${on_exit_items[$onex]} >>$LOGFILE 2>&1 done on_exit_items="" trap - EXIT } # register a command to execute when the calling script terminates. The -# registered commands are called in FIFO order. +# registered commands are called in FILO order. # $* - command to register do_on_exit() { @@ -126,7 +127,7 @@ graceful_umount() [ ! $secs ] && secs=5 let steps=$secs*100 - for i in `seq 1 $steps` + for st in `seq 1 $steps` do umount $1 >>$LOGFILE 2>&1 mount | grep $1 >/dev/null 2>&1 |