上一页 1 ··· 293 294 295 296 297 298 299 300 301 ··· 367 下一页
摘要: 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) 编辑
摘要: linux shell脚本中流程控制语句 if、for、while、case 1、if语句 [root@centos7 test2]# ls test.sh [root@centos7 test2]# pwd /home/test2 [root@centos7 test2]# cat test.sh 阅读全文
posted @ 2021-04-21 23:16 小鲨鱼2018 阅读(339) 评论(0) 推荐(0) 编辑
摘要: linux系统中条件测试语句分为4类: 1、文件测试语句 2、逻辑测试语句 3、整数值比较语句 4、字符串比较语句 一、文件测试语句 -e :是否存在 -f :是否为文件 -d:是否为目录文件 -r:是否具有读的权限 -w: 是否具有写的权限 -x:是否具有执行的权限 [root@PC3 test] 阅读全文
posted @ 2021-04-21 18:35 小鲨鱼2018 阅读(211) 评论(0) 推荐(0) 编辑
摘要: 1、基本shell脚本 #!/bin/bash command 2、参数的变量 $0:脚本名称 $#:参数的数目 $*:参数 $1:第一个参数 $2:第二个参数 $3:第三个参数 $?:上一条命令执行成功输出0,否则其他数字。 [root@PC3 test]# cat a.sh #!/bin/bas 阅读全文
posted @ 2021-04-21 18:10 小鲨鱼2018 阅读(724) 评论(0) 推荐(0) 编辑
摘要: 1、read从键盘读入 [root@centos7 test]# echo $a [root@centos7 test]# read a 123456 [root@centos7 test]# echo $a 123456 2、-p 参数 加入提示 [root@centos7 test]# unse 阅读全文
posted @ 2021-04-21 13:58 小鲨鱼2018 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 1、测试for cat [root@PC3 test]# cat a.txt 01 02 03 06 07 08 11 12 13 16 17 18 [root@PC3 test]# for i in `cat a.txt`; do echo $i ; done 01 02 03 06 07 08 阅读全文
posted @ 2021-04-21 13:06 小鲨鱼2018 阅读(1405) 评论(0) 推荐(0) 编辑
摘要: 1、测试数据 [root@PC3 test]# cat a.txt e i e s d e t q s g e g 2、 [root@PC3 test]# cat a.txt e i e s d e t q s g e g [root@PC3 test]# sed 's/ /\n/g' a.txt 阅读全文
posted @ 2021-04-21 12:29 小鲨鱼2018 阅读(757) 评论(0) 推荐(0) 编辑
摘要: 1、过滤是5的倍数的数值 #include <stdio.h> int main(void) { int i = 1, j; puts("please input an integer."); printf("j = "); scanf("%d", &j); for (i; i <= j; i++) 阅读全文
posted @ 2021-04-20 23:06 小鲨鱼2018 阅读(151) 评论(0) 推荐(0) 编辑
摘要: c语言中continue语句;执行continue语句后,循环体的剩余部分就会被跳过。 例子; 1、原始程序。输出矩形。 #include <stdio.h> int main(void) { int i, j, height, width; puts("please input the heigh 阅读全文
posted @ 2021-04-20 22:37 小鲨鱼2018 阅读(1150) 评论(0) 推荐(0) 编辑
摘要: 1、原始程序 #include <stdio.h> int main(void) { int i = 1, j; puts("please input an integer."); do { printf("j = "); scanf("%d", &j); if (j <= 0) puts("the 阅读全文
posted @ 2021-04-20 21:42 小鲨鱼2018 阅读(309) 评论(0) 推荐(0) 编辑
上一页 1 ··· 293 294 295 296 297 298 299 300 301 ··· 367 下一页