shell数组
来源:互联网 发布:mac中的照片在哪里 编辑:程序博客网 时间:2024/06/07 05:12
shell数组:
a=(1 2 3 4 5) //都是数字
str=(1 2 hello "good morning") //含有数字,字符串的数组
${#str[@]} 或${#str[*]} //获取数组长度,格式为${#数组名[@或者为*]}
echo ${#str[@]} 输出为4
echo ${str[@]}或者${str[*]} 输出数组所有内容
数组分片:
a=(1 2 3 4 5)
echo ${a[@]:0:3}
输出为1 2 3
数组替换:${数组名[@或*]/查找字符/替换字符}
echo ${a[@]/3/100}
输出为1 2 100 4 5
数组删除
unset a
echo a 为空已删除
unset ${a[0]} 将a[0]删除
0 0
- shell数组
- shell数组
- shell 数组
- shell数组
- shell数组
- shell 数组
- shell-------------数组
- shell 数组
- shell数组
- shell数组
- shell数组
- Shell 数组
- shell数组
- shell数组
- shell 数组
- shell数组
- shell数组
- shell 数组
- Python tuple元组介绍
- 解决The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path配置路径还是有错误标志的解决
- NSBundle mainBundle
- Eclipse 的快捷键 大全
- 使用两个stack对一个stack的内容进行反转
- shell数组
- Android消息提示:AlertDialog、Toast、Notification的使用
- POJ2398——Toy Storage
- 策略模式题
- Longest Palindromic Substring
- hdu 3460 Ancient Printer 字典树
- POJ---3278-Catch That Cow(BFS/deque)
- python 线程,GIL 和 ctypes
- 买票找零