功能就是sh文件分割字符串到数组并遍历引用,示例代码如下:

CURLURL="1;2;5;9"
IFS=";"
read -r -a array <<< "$CURLURL"
for i in "${!array[@]}"; do
echo -e ${array[i]}"\n"
done

方法整理自:https://stackoverflow.com/questions/10586153/split-string-into-an-array-in-bash

Related Posts: Linux shell 分割字符串到数组并遍历引用示例 :

avatar
spark
游客
spark

wpdiscuz回复按钮手机版错位