码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2016-03-18 17:28:45      阅读:182      评论:0      收藏:0      [点我收藏+]

标签:

参考资料:

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 1 ]; 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

 

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

标签:

原文地址:http://www.cnblogs.com/junneyang/p/5292736.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!