shell遍历数组
JUMP_XCX=('xxx_111' 'yyy_222' 'zzz_333')
if [[ $JUMP_XCX != '' ]]; then # 可以判断空字符串 和 空数组
NEW_JUMP_XCX=''
for v in ${JUMP_XCX[@]};do
if [[ $NEW_JUMP_XCX = '' ]];then
NEW_JUMP_XCX+="'$v'"
else
NEW_JUMP_XCX+=",'$v'"
fi
done
sed -i "s#^\$jump_xcx.*;#\$jump_xcx=[${NEW_JUMP_XCX}];#g" $uniform_file
fi
处理成php数组
$jump_xcx=['xxx_111','yyy_222','zzz_333'];
什么数组不数组的,本质都是字符串。