摘要: 1、测试1 [root@centos7 test2]# i=0 [root@centos7 test2]# max=5 [root@centos7 test2]# while((i<max));do echo $i;((i++));done 0 1 2 3 4 阅读全文
posted @ 2021-04-22 18:47 小鲨鱼2018 阅读(71) 评论(0) 推荐(0) 编辑
摘要: 1、测试1 [root@centos7 test2]# for ((i=1; i<=5; i++)); do echo "100"; done 100 100 100 100 100 阅读全文
posted @ 2021-04-22 18:45 小鲨鱼2018 阅读(59) 评论(0) 推荐(0) 编辑
摘要: 1、测试1 [root@centos7 test2]# cat test.sh #!/bin/bash read -p "please input an character: " i case $i in [a-z]|[A-Z]) echo "letter!" ;; [0-9]) echo "num 阅读全文
posted @ 2021-04-22 17:07 小鲨鱼2018 阅读(705) 评论(0) 推荐(0) 编辑
摘要: 1、隐藏光标 echo -e "\033[?25l" 2、显示光标 echo -e "\033[?25h" 来源:https://blog.csdn.net/weixin_43336281/article/details/99109789 阅读全文
posted @ 2021-04-22 16:19 小鲨鱼2018 阅读(350) 评论(0) 推荐(0) 编辑
摘要: 1、测试1 求1-100的和 [root@centos7 test2]# cat test.sh #!/bin/bash sum=0 a=1 while [ $a -le 100 ] do let sum+=$a let a++ done echo "the sum of 1-100 is: $su 阅读全文
posted @ 2021-04-22 15:51 小鲨鱼2018 阅读(1261) 评论(0) 推荐(0) 编辑
摘要: 1、for语句 [root@centos7 test2]# cat test.sh #!/bin/bash sum=0 for i in `seq $1` do let sum+=$i done echo "the sum of 1-$1 is: $sum" [root@centos7 test2] 阅读全文
posted @ 2021-04-22 13:05 小鲨鱼2018 阅读(3759) 评论(0) 推荐(0) 编辑
摘要: 1、测试1 [root@centos7 test2]# ls a.txt [root@centos7 test2]# if [ -e a.txt ]; then echo "exist";else echo "no nxist"; fi exist [root@centos7 test2]# if 阅读全文
posted @ 2021-04-22 12:35 小鲨鱼2018 阅读(282) 评论(2) 推荐(0) 编辑