'Generates new shell command as array, contains map as variables to
arguments statement (varsStat), the command (realCmd) used this variables and
the list of the arguments, mapped from varsDict
Example:
buildShellCmd(\'echo "V2: $v2, V1: $v1"\', {"v1": "val 1", "v2": "val 2", "vUnused": "unused var"})
returns:
[\'v1=$0 v2=$1 vUnused=$2
echo "V2: $v2, V1: $v1"\', \'val 1\', \'val 2\', \'unused var\']'

@staticmethod
def buildShellCmd(realCmd, varsDict):

    varsStat = ''
    if (not isinstance(realCmd, list)):
        realCmd = [realCmd]
    i = (len(realCmd) - 1)
    for (k, v) in varsDict.iteritems():
        varsStat += ('%s=$%s    ' % (k, i))
        realCmd.append(v)
        i += 1
    realCmd[0] = ((varsStat + '\n') + realCmd[0])
    return realCmd
