![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
shell
聪明的大嘴花
这个作者很懒,什么都没留下…
展开
-
shell小知识
拼接字符串并执行a="ps -ef |"b="grep xxx"eval ${a} ${b} # 相当于执行了 ps -ef | grep xxx去掉字符串最后一个字符str="abcdefg"echo ${str%?} # --> abcdef原创 2021-11-25 11:04:57 · 88 阅读 · 0 评论 -
shell中创建数组并循环读取
#!/bin/bash# 定义一个数组array=()# for 循环往自定义数组增加数据for((i=1;i<=5;i++))do # 往数组里面加数据 array[${i}]=${i}done# 遍历数组for num in ${array[*]}do echo $numdone原创 2021-11-24 15:08:50 · 1461 阅读 · 0 评论