功能就是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



与《Linux shell 分割字符串到数组并遍历引用示例》相关的博文:

2
留言

spark
spark

wpdiscuz回复按钮手机版错位