上一页 1 ··· 213 214 215 216 217 218 219 220 221 ··· 367 下一页
摘要: 1、逻辑与&&: 在前面语句执行成功时才执行后面的语句 [root@rhelpc1 test]# ls a.txt [root@rhelpc1 test]# wc -l a.txt 0 a.txt [root@rhelpc1 test]# wc -l a.txt && echo OK ## 逻辑与& 阅读全文
posted @ 2022-03-29 16:27 小鲨鱼2018 阅读(423) 评论(0) 推荐(0) 编辑
摘要: 1、 $0: 当前的shell文件名 $#: 一共包含几个参数 $*: 所有的参数 $?:上一步执行的结果,成功执行返回0,不成功执行返回1或其他 $1: 第一个参数 $2:第二个参数 $3: 第三个参数 测试: [root@rhelpc1 test]# ls test.sh [root@rhelp 阅读全文
posted @ 2022-03-29 15:49 小鲨鱼2018 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 1、测试 [root@rhelpc1 test2]# ls [root@rhelpc1 test2]# seq 10 > a.txt [root@rhelpc1 test2]# ls a.txt [root@rhelpc1 test2]# cat a.txt ## 测试数据 1 2 3 4 5 6 阅读全文
posted @ 2022-03-29 15:46 小鲨鱼2018 阅读(427) 评论(0) 推荐(0) 编辑
摘要: 1、行选择 vim file打开文件,在命令模式下输入大写V即可: 按方向键或数字+j/k可以实现行的选择。 2、列选择 vim file打开文件,命令模式下输入ctrl + v即可: 按方向键可以实现列选择。 阅读全文
posted @ 2022-03-29 14:32 小鲨鱼2018 阅读(3625) 评论(0) 推荐(0) 编辑
摘要: 1、 删除当前行: dd 删除当前行及向下3行:3dd 或者 d3j 删除当前行及向上3行:d3k 删除当前行及到第1行:d1G 或者 d+gg 删除当前行到最后1行:dG 删除光标所在位置及到行末:d$ 或者D 删除光标所在位置到行首:d0 删除当前字符:x, 相当于delete键 删除当前字符: 阅读全文
posted @ 2022-03-28 22:37 小鲨鱼2018 阅读(2818) 评论(0) 推荐(0) 编辑
摘要: 1、Shell 的变量,可以分为“环境变量”和“自定义变量”两种类型,两者的区别在于作用范围不同。环境变量可以在其进程的子进程中继续有效,而自定义变量的势力范围则无法延伸到其进程的子进程中。 [root@localhost test]# ls [root@localhost test]# A=100 阅读全文
posted @ 2022-03-28 21:59 小鲨鱼2018 阅读(238) 评论(0) 推荐(0) 编辑
摘要: 1、直接使用type命令进行判断 [root@localhost test]# type pwd ## pwd是内部命令 pwd is a shell builtin [root@localhost test]# type plink ## plink是外部命令 plink is hashed (/ 阅读全文
posted @ 2022-03-27 22:17 小鲨鱼2018 阅读(187) 评论(0) 推荐(0) 编辑
摘要: 1、创建别名命令 [root@localhost test]# pwd /home/test [root@localhost test]# abc bash: abc: command not found... [root@localhost test]# alias abc=pwd ## 创建别名 阅读全文
posted @ 2022-03-27 22:06 小鲨鱼2018 阅读(1019) 评论(0) 推荐(0) 编辑
摘要: 双引号“”:不进行转义,保留变量属性。 单引号‘’:进行转义,使其成为单纯的字符串。 [root@localhost test]# A=10 [root@localhost test]# echo $A 10 [root@localhost test]# echo "number is $A" ## 阅读全文
posted @ 2022-03-27 21:51 小鲨鱼2018 阅读(3204) 评论(0) 推荐(0) 编辑
摘要: ?:表示匹配任意一个。 *:表示匹配0个或任意多个 [root@localhost test]# ls ab ab1 ab12 ab123 [root@localhost test]# ls -l ab* ## *表示匹配0个或任意多个 -rw-r--r--. 1 root root 0 Mar 2 阅读全文
posted @ 2022-03-27 21:40 小鲨鱼2018 阅读(825) 评论(0) 推荐(0) 编辑
上一页 1 ··· 213 214 215 216 217 218 219 220 221 ··· 367 下一页