
bash
文章平均质量分 58
qq_21696621
这个作者很懒,什么都没留下…
展开
-
文本三剑客 - grep、egrep
[root@study shell-study]# cat file i love python lovelove python love I Love PYTHON I Love pYtHoN [root@study shell-study]# grep python file i love python lovelove python [root@study shell-study]# [root@study shell-study]# grep -E 'python|PYTHON' ...翻译 2021-03-16 17:52:56 · 111 阅读 · 0 评论 -
函数的高级使用
函数的定义与使用 # 在终端中直接写定义和调用函数 [root@study shell-study]# test() > { > echo "test function" > } [root@study shell-study]# test test function 脚本:检查nginx进程是否存在,若不存在则自动拉起该进程,并将该脚本变成守护进程 方法1 #!/bin/bash # while true do this_pid=$$ # $$返..翻译 2021-03-16 16:49:04 · 111 阅读 · 0 评论 -
变量的高级使用
变量的替换 (1)使用一个#变量 (2)使用两个#变量 (3)使用一个%变量 (4)使用两个%变量 (5)使用一个/替换 (6)使用两个/替换 字符串处理 (1)计算字符串长度 方法一:${#string} 方法二:expr length $string (2)获取字符索引位置。将substr拆分为一个一个字符,从$string中查找满足字符的$string的第一个字符的位置。 expr index “$stri...翻译 2021-03-12 15:45:03 · 151 阅读 · 0 评论