bashscripts(3)
Example 5-4. Integer or string?
创新互联服务项目包括安宁网站建设、安宁网站制作、安宁网页制作以及安宁网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,安宁网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到安宁省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!
#!/bin/bash # int-or-string.sh # Integer or string? a=2334 # Integer. let "a += 1" echo "a = $a " # Integer, still. echo b=${a/23/BB} # Transform into a string. echo "b = $b" # BB35 declare -i b # Declaring it an integer doesn't help. echo "b = $b" # BB35, still. let "b += 1" # BB35 + 1 = echo "b = $b" # 1 echo c=BB34 echo "c = $c" # BB34 d=${c/BB/23} # Transform into an integer. echo "d = $d" # 2334 let "d += 1" # 2334 + 1 = echo "d = $d" # 2335 # Variables in Bash are essentially untyped. exit 0 |
标题名称:bashscripts(3)
分享网址:http://ybzwz.com/article/phohgd.html