【Linux】shell字符串分割、数组访问、条件判断

参考资料:

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
上一篇:Struts2--HelloWord


下一篇:【Linux】linux bash shell之变量替换::=句法、=句法、:-句法、-句法、=?句法、?句法、:+句法、+句法