参考资料:
shell字符串分割再循环:http://www.shangxueba.com/jingyan/1633455.html
linux shell中 if else以及大于、小于、等于逻辑表达式介绍:http://www.jb51.net/article/34332.htm
Shell数组:shell数组的定义、数组长度:http://c.biancheng.net/cpp/view/7002.html
shell 数组长度:http://blog.csdn.net/shaobingj126/article/details/7395570
shell 数组长度:http://blog.csdn.net/lhf_tiger/article/details/18882223
示例代码:
API_Proxy_IP_List=(`echo ${API_Proxy_IP} | tr ";" "\n"`)
if [ ${#API_Proxy_IP_List[@]} -ne ]; then
echo "==========API_Proxy_IP Has More Than One Item, Do Nothing...=========="
else
echo "==========API_Proxy_IP Has One Item, Update The /etc/hosts...=========="
mungehosts -a "${API_Proxy_IP} ${API_domain}"
fi