shell 内部域分隔IFS环境变量:
1.
data="name,sex,rollno,location"
oldIFS=$IFS # 备份IFS到变量oldIFS
IFS=$',' # 将IFS设置为逗号,便于做data的分隔符
IFS=$oldIFS # 最后将IFS还原
for item in $data;do echo Item:$item;done
2.
data_code="name:sex:rollno:location"
data_value="gender:certificate_type:certificate_no:birthday"
OldIFS=$IFS
IFS=':'
array1=($data_code)
array2=($data_value)
IFS=$OldIFS
for db_name in ${array1[@]}
do
echo $db_name
done