字符串分割示例如下:
hours="00,01,02" IFS="," arr=($hours) for hour in ${arr[@]};do echo $hour done hours=("00,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23") IFS="," for hour in ${hours[@]};do echo $hour done
字符串分割示例如下:
hours="00,01,02" IFS="," arr=($hours) for hour in ${arr[@]};do echo $hour done hours=("00,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23") IFS="," for hour in ${hours[@]};do echo $hour done