scripts/qemustart: more portable array operation
authorYousong Zhou <yszhou4tech@gmail.com>
Thu, 11 May 2017 06:29:52 +0000 (14:29 +0800)
committerYousong Zhou <yszhou4tech@gmail.com>
Wed, 31 Jan 2018 08:54:57 +0000 (16:54 +0800)
commitaa66aa0c9a77c115de0efcaf6ee59650b969b90d
tree9b8cc0e5e21d6192c19f5b0c69efba7bd0e55e2c
parentc9c2e4d78dc683b46b7f31b230afbdcdc13b81f6
scripts/qemustart: more portable array operation

The following commands output 1,2,1,1

    cmd0='a=("${a[@]}" 'a'); echo "${#a}"'
    cmd1='a+=('a'); echo "${#a}"'
    bash -c "$cmd0"; zsh -c "$cmd0"
    bash -c "$cmd1"; zsh -c "$cmd1"

The following outputs 0,1,0,0

    cmd2='f() { echo "$#"; }; f "${a[@]}"'
    cmd3="a=(); $cmd2"
    bash -c "$cmd2"; zsh -c "$cmd2"
    bash -c "$cmd3"; zsh -c "$cmd3"

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
scripts/qemustart