最近需要写一些脚本,其中一个需求就是把命令执行的结果存到一个数组,在后面遍历循环使用它,不多说直接上代码:
basharray=(`./qshell listbucket2 mereith-www | awk '{print $1}'`) len=${#array[@]} i=0 while [ $i -lt $len ] do ./qshell delete mereith-www "${array[$i]}" #echo `${array[$i]}` let i++ done
array=(`./qshell listbucket2 mereith-www | awk '{print $1}'`) len=${#array[@]} i=0 while [ $i -lt $len ] do ./qshell delete mereith-www "${array[$i]}" #echo `${array[$i]}` let i++ done
在你操作命令后面加--allow-unrelated-histories
--allow-unrelated-histories