test.sh脚本如下:
apps="${1}"
#按“T”分隔
arr=(${apps//T/ })
for app in ${arr[@]}
do
apps2="${app}"
#按“,”分隔
arr2=(${apps2//,/ })
for app2 in ${arr2[@]}
do
echo "${app2}"
done
done
调用并输出:
sh test.sh 1,2T11,12T111,112
1
2
11
12
111
112