随笔分类 -  linux shell

上一页 1 ··· 43 44 45 46 47 48 49 50 51 ··· 78 下一页
摘要:1、 root@PC1:/home/test2# ls test.sh root@PC1:/home/test2# cat test.sh ## 脚本 #!/bin/bash ANSWER=$(expr $RANDOM % 100) TIMES=0 echo "the range is 0-100, 阅读全文
posted @ 2022-05-23 21:46 小鲨鱼2018 阅读(311) 评论(0) 推荐(0)
摘要:001、 root@PC1:/home/test2# ls root@PC1:/home/test2# a=abd root@PC1:/home/test2# echo $a abd root@PC1:/home/test2# [ $a =~ ^a ] && echo yes ## 单个[]不支持匹 阅读全文
posted @ 2022-05-23 21:07 小鲨鱼2018 阅读(881) 评论(0) 推荐(0)
摘要:1、 root@PC1:/home/test2# ls test.sh root@PC1:/home/test2# cat test.sh ## script #!/bin/bash SUM=0 MIN=100 MAX=0 COUNT=0 while [ $COUNT -lt 5 ] do read 阅读全文
posted @ 2022-05-23 20:49 小鲨鱼2018 阅读(528) 评论(0) 推荐(0)
摘要:[[:alnum:]] = [a-zA-Z0-9] root@PC1:/home/test/test# ls a.txt root@PC1:/home/test/test# cat a.txt GMM 201 0 0 0 GMM 202 0 0 0 GMM 203 0 0 0 root@PC1:/h 阅读全文
posted @ 2022-05-16 23:26 小鲨鱼2018 阅读(439) 评论(0) 推荐(0)
摘要:001、 root@PC1:/home/test2# ls a.txt root@PC1:/home/test2# cat a.txt hello world root@PC1:/home/test2# sed 's/\(hello\) \(world\)/\2 \1/' a.txt ## 第一个小 阅读全文
posted @ 2022-05-16 00:35 小鲨鱼2018 阅读(107) 评论(0) 推荐(0)
摘要:1、系统 [root@PC1 network-scripts]# hostnamectl Static hostname: PC1 Icon name: computer-vm Chassis: vm Machine ID: 7d8c7dacd42740ff9603a3e8bbf222da Boot 阅读全文
posted @ 2022-05-11 23:49 小鲨鱼2018 阅读(5285) 评论(0) 推荐(0)
摘要:1、 root@PC1:/home/test# ls a.txt root@PC1:/home/test# cat a.txt i aaaadff f aaewrg k aaarbcd j aaaaavvvv i aaaaaaaaere root@PC1:/home/test# grep -E "a 阅读全文
posted @ 2022-05-09 23:13 小鲨鱼2018 阅读(680) 评论(0) 推荐(0)
摘要:1、sort -u实现 root@PC1:/home/test# ls a.txt root@PC1:/home/test# cat a.txt a b c x y z a b c m n o m n o root@PC1:/home/test# sort -u a.txt ## sort -u删除 阅读全文
posted @ 2022-05-09 19:23 小鲨鱼2018 阅读(352) 评论(0) 推荐(0)
摘要:1、 root@PC1:/home/test# ls a.txt root@PC1:/home/test# cat a.txt ## 测试数据 d xaa c xaaa d xaaaa e xaaaaa f xaaaaaa d dff gfgfgf e dfgdg gfdgedr d dfef fc 阅读全文
posted @ 2022-05-09 15:24 小鲨鱼2018 阅读(2171) 评论(0) 推荐(0)
摘要:1、 root@PC1:/home/test# ls a.txt root@PC1:/home/test# cat a.txt ## 测试数据 d aab c aaab d aaaax e aaaaax f aaaaaax root@PC1:/home/test# grep -E "a{2}" a. 阅读全文
posted @ 2022-05-09 13:39 小鲨鱼2018 阅读(652) 评论(0) 推荐(0)
摘要:1、 root@liujiaxinpc1:/home/test# echo $a 100 root@liujiaxinpc1:/home/test# echo $b root@liujiaxinpc1:/home/test# [ $a ] ## 变量有赋值, 返回真 root@liujiaxinpc 阅读全文
posted @ 2022-05-06 16:44 小鲨鱼2018 阅读(560) 评论(0) 推荐(0)
摘要:-n: 当字符串不为0是为真; 字符串为0是为假。 n表示non-zero 示例: root@liujiaxinpc1:/home/test# a=100 root@liujiaxinpc1:/home/test# echo $a 100 root@liujiaxinpc1:/home/test# 阅读全文
posted @ 2022-05-06 16:31 小鲨鱼2018 阅读(8616) 评论(0) 推荐(0)
摘要:原文:https://blog.csdn.net/coolfishbone_joey/article/details/119956378 echo 显示内容颜色,需要使用 -e 参数 -e :打开反斜杠转义 (默认不打开) ,可以转义 “\n, \t” 等 -n:在最后不自动换行 str="kimb 阅读全文
posted @ 2022-05-06 11:23 小鲨鱼2018 阅读(606) 评论(0) 推荐(0)
摘要:1、举例1: root@PC1:/home/test# ls test.sh root@PC1:/home/test# cat test.sh #!/bin/bash read -p "please input a character: " KEY case $KEY in ## 利用变量KEY进行 阅读全文
posted @ 2022-05-06 10:42 小鲨鱼2018 阅读(202) 评论(0) 推荐(0)
摘要:1、统计频次 [root@localhost test]# ls a.txt [root@localhost test]# cat a.txt a a b a b a b b b b [root@localhost test]# awk '{array[$1]++} END {for(i in ar 阅读全文
posted @ 2022-05-05 23:40 小鲨鱼2018 阅读(114) 评论(0) 推荐(0)
摘要:1、问题vim编辑没有颜色 2、解决方法 [root@localhost test]# rpm -q vim-enhanced package vim-enhanced is not installed [root@localhost test]# yum install vim-enhanced. 阅读全文
posted @ 2022-05-05 22:15 小鲨鱼2018 阅读(445) 评论(0) 推荐(0)
摘要:问题 1、linux中vim backspace无法向左删除 2、解决方法 [root@localhost test]# echo "set backspace=2" >> ~/.vimrc ## 修改配置文件 3、测试 没有问题。 阅读全文
posted @ 2022-05-05 21:39 小鲨鱼2018 阅读(426) 评论(0) 推荐(0)
摘要:1、问题 vim 8.2 右键无法粘贴, 进入VISUAL 2、解决方法 [root@localhost ~]# find / -name "defaults.vim" /home/software/vim-8.2.1862/runtime/defaults.vim /usr/share/vim/s 阅读全文
posted @ 2022-05-05 20:59 小鲨鱼2018 阅读(1101) 评论(0) 推荐(0)
摘要:1、系统 [root@localhost test]# lsb_release -a LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noa 阅读全文
posted @ 2022-05-05 20:35 小鲨鱼2018 阅读(436) 评论(0) 推荐(0)
摘要:1、测试数据 root@PC1:/home/test2# ls test.txt root@PC1:/home/test2# cat test.txt attatgcccagggtttgttacttcagatgtgtccagagtttctcccttct ggcaggttcatggtcttgctcac 阅读全文
posted @ 2022-05-05 17:19 小鲨鱼2018 阅读(847) 评论(0) 推荐(0)

上一页 1 ··· 43 44 45 46 47 48 49 50 51 ··· 78 下一页