cut string by semicolon to arrary in bash
#!/bin/bash
str="item1;item2;item3"
array=($(echo $str|tr ',' ' '|tr -s ' ')) #bash的方法
echo ${array[1]}
#item2
for s in ${arry[@]}; do echo "$s"; done
#item1 item2 item3
#or use this method
OLD_IFS="$IFS"
IFS=","
array=($str)
IFS="$OLD_IFS"
echo ${array[1]}
#item2
for s in ${arry[@]}; do echo "$s"; done
#item1 item2 item3