上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 367 下一页
摘要: 001、脚本解释器用于说明程序执行的方式。 [root@pc1 test1]# ls ## 两个测试脚本, test02.script 相比于test01.script多了指定python解释器的语句 #!/usr/bin/env python test01.script test02.script 阅读全文
posted @ 2024-03-08 16:56 小鲨鱼2018 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 001、第一句通常为 a、#!/usr/bin/env python b、#!/usr/bin/python 首先以上两脚都是指定脚本语言的解释器,均表示 用python解释器执行下面的脚本。 a的写法比b的写法更加的健壮。 因为b把解释器写死了, 如果python的可执行程序不在/usr/bin/ 阅读全文
posted @ 2024-03-08 16:55 小鲨鱼2018 阅读(299) 评论(0) 推荐(0) 编辑
摘要: 001、基础绘图 library(ggplot2)#导入ggplot包 ggplot(data = mtcars, aes(x = wt, y = mpg, colour = factor(cyl))) + geom_point() + theme_bw() 002、设置刻度标签的粗细 librar 阅读全文
posted @ 2024-03-07 21:42 小鲨鱼2018 阅读(11) 评论(0) 推荐(0) 编辑
摘要: 001、为了避免脚本多次执行,生成结果多次追加,可以在追加语句的前面增加清空语句避免多次追加 [root@pc1 test1]# ls a.sh [root@pc1 test1]# cat a.sh ## 测试脚本 #!/bin/bash > result.txt ## 或者使用 rm -f res 阅读全文
posted @ 2024-03-06 10:59 小鲨鱼2018 阅读(20) 评论(0) 推荐(0) 编辑
摘要: 001、在特定的情况下,为了防止脚本重复执行,造成混乱,可以在末尾追加如下语句避免脚本重复执行 [root@pc1 test1]# ls a.sh [root@pc1 test1]# cat a.sh ## 测试脚本 #!/bin/bash seq 2 seq 2 sed -i 's/^/#/' $ 阅读全文
posted @ 2024-03-06 10:44 小鲨鱼2018 阅读(47) 评论(0) 推荐(0) 编辑
摘要: linux 中declare命令的用法 001、声明整数型变量 [root@pc1 test1]# declare -i var1 ## 声明变量为整数型变量 [root@pc1 test1]# var1=132 ## 赋值整数型变量 [root@pc1 test1]# echo $var1 ## 阅读全文
posted @ 2024-03-04 19:53 小鲨鱼2018 阅读(30) 评论(0) 推荐(0) 编辑
摘要: linux shell脚本中 =~ 的作用 =~ 表示正则表达式左侧是否匹配右侧。 001、举例如下: [root@pc1 test1]# str1=12343 ## 纯数字字符串 [root@pc1 test1]# str2=abdef ## 字母字符串 [root@pc1 test1]# str 阅读全文
posted @ 2024-03-04 12:22 小鲨鱼2018 阅读(576) 评论(0) 推荐(0) 编辑
摘要: linux 中如何判断变量是否为数值 001、 利用正则表达式判断 a、 [root@pc1 test1]# str1="abcd" ## 字母字符串 [root@pc1 test1]# str2="100" ## 数字字符串 [root@pc1 test1]# re="^[-+]?[0-9]+([ 阅读全文
posted @ 2024-03-04 12:16 小鲨鱼2018 阅读(102) 评论(0) 推荐(0) 编辑
摘要: linux 中正则表达式中?号的作用是匹配前面的字母0次或者1次; 001、测试如下: [root@pc1 test1]# ls a.txt [root@pc1 test1]# cat a.txt ## 测试样本 abcd xyz 133 kkkk abde jjj dddu abbcde jjj 阅读全文
posted @ 2024-03-04 12:13 小鲨鱼2018 阅读(95) 评论(0) 推荐(0) 编辑
摘要: 001、简单用法 > a <- c(1,2, 7, 8) ## 定义向量a > b <- c(2, 3, 7, 9) ## 定义向量b > a %in% b ## 判断向量a中元素是否在向量b中,返回逻辑向量 [1] FALSE TRUE TRUE FALSE 002、取两个向量的交集 > a <- 阅读全文
posted @ 2024-03-03 22:30 小鲨鱼2018 阅读(262) 评论(0) 推荐(0) 编辑
上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 367 下一页