摘要:
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
阅读(518)
评论(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
阅读(2034)
评论(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
阅读(281)
评论(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
阅读(125)
评论(0)
推荐(0)

浙公网安备 33010602011771号