1. 字符串
stringA="one,two,three,four"
2. 拆分
OLD_IFS="$IFS"
IFS=","
arr=($stringA)
IFS="$OLD_IFS"
for s in ${arr[@]}
do
echo "$s"
done
3. 输出
one
two
three
four
stringA="one,two,three,four"
OLD_IFS="$IFS"
IFS=","
arr=($stringA)
IFS="$OLD_IFS"
for s in ${arr[@]}
do
echo "$s"
done
one
two
three
four