数组编程

#!/bin/bash
# array
soft=(
php
mysql
nginx
)
# 输出第一个
echo ${soft[0]}
# 输出所有
echo "This soft total ${soft[@]}"
# 输出数量
echo "This soft count ${#soft[@]}"
# 删除一个元素
unset soft[2]
echo "This soft total ${soft[@]}"
# 临时替换
echo ${soft[@]/php/java}
echo "This soft total ${soft[@]}"

运行结果

# /bin/bash array.sh
php
This soft total php mysql nginx
This soft count 3
This soft total php mysql
java mysql
This soft total php mysql

最新文章

  1. linux下安装nodejs
  2. Json数据的学习
  3. 9.3---魔术索引(CC150)
  4. android: 从相册中选择照片
  5. 修正magento快速搜索返回结果不准确
  6. <javascript搞基程序设计>笔记2015-9-25
  7. 【HDOJ】1987 Decoding
  8. 02将代码开源到github(不会使用github的来看看吧)
  9. deque,list,queue,priority_queue
  10. Effective Java 第三版——39. 注解优于命名模式
  11. netty 之 telnet HelloWorld 详解
  12. SpringBoot自动配置原理
  13. 3.CNN-卷积神经网络推导
  14. [转]Angular4首页加载慢优化之路
  15. C#字节数组与字符串转换
  16. Java并发编程:volatile关键字解析zz
  17. Apache-配置、测试和调试
  18. xshell 利用密钥登录
  19. AnyVal与AnyRef
  20. react学习笔记1之声明组件的两种方式

热门文章

  1. 读取xml文件,写入excel
  2. SIP UserAgent (B2BUA client)——pjsip
  3. Spark SQL中UDF和UDAF
  4. linux的虚拟机时间和物理机时间同步
  5. PAT 1048 Find Coins[比较]
  6. 设置npm淘宝代理
  7. C++学习笔记--名称空间
  8. 【Q2D】如何导出自定义C++类给框架使用
  9. 51nod 1391 01串(hash+DP)
  10. Java ArrayList详细介绍和使用示例