From 156d2ea9e08d1f0a551a36007d670e4ee24689d0 Mon Sep 17 00:00:00 2001 From: Jaime Melis Date: Wed, 25 Apr 2012 11:59:59 +0200 Subject: [PATCH] Feature #1222: Improve readability of the context scripts --- src/tm_mad/common/context | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/tm_mad/common/context b/src/tm_mad/common/context index 913789c62e..d419cd60fa 100755 --- a/src/tm_mad/common/context +++ b/src/tm_mad/common/context @@ -23,20 +23,12 @@ # - vmid is the id of the VM # - 0 is the target datastore (system) -i=1 -for arg in "$@"; do - if [ $i -eq $# ]; then - DS_ID="$arg" - elif [ $i -eq $(($#-1)) ]; then - VM_ID="$arg" - elif [ $i -eq $(($#-2)) ]; then - DST="$arg" - else - SRC="$SRC $arg" - fi +ARGV=("$@") - let i=i+1 -done +DS_ID="${ARGV[$(($#-1))]}" +VM_ID="${ARGV[$(($#-2))]}" +DST="${ARGV[$(($#-3))]}" +SRC="${ARGV[@]:0:$(($#-3))}" if [ -z "${ONE_LOCATION}" ]; then TMCOMMON=/var/lib/one/remotes/tm/tm_common.sh