- 博客(13)
- 收藏
- 关注
原创 2021-04-21
linux 配置互信 互信就是在一个节点登录其他节点的时候,可以直接登上去,不需要密码。 比如我想在ip1上跟ip2互信,那么分别在两个节点上执行: ssh-keygen -t rsa 生成类似一下的结果: [root@localhost io-500-dev-master]# ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa):
2021-04-21 15:58:20
50
原创 2021-02-18
shell脚本编程学习第十二天 利用 bash for 循环打印下面这句话中字母数不大于 6 的单词。 I am oldboy teacher welcome to oldboy training class #!/bin/bash arr=(I am oldboy teacher welcome to oldboy training class) for i in ${arr[*]} do if [[ ${#i} -le 6 ]];then echo "$i" fi don
2021-02-19 10:09:43
97
原创 2021-02-09
shell脚本编程学习第十一天 K、teamlist.txt的内容为: Name,Team,First Test, Second Test, Third Test Tom,Red,5,17,22 Joe,Green,3,14,22 Maria,Blue,6,18,21 Fred,Blue,2,15,23 Carlos,Red,-1,15,24 Phuong,Green,7,19,21 Enrique,Green,3,16,20 Nancy,Red,9,12,24 编写一个awk脚本用来计算每个人的平均成绩,
2021-02-09 15:57:04
150
原创 2021-02-07
shell脚本编程学习第十天 J、传入至少三个数字参数到脚本file,并计算出最大,最小,平均值。需要判断传入的数字是否足够,否则输出警告信息。平均值保留两位小数。 如执行./file 3 4 6 5,输出结果如下: max number is:6 min number is:3 average is:4.50 参数的特殊处理: $# : 返回参数的个数 $* : 返回所有参数, 以 $1 $2 ...
2021-02-08 15:43:56
81
1
原创 2021-02-07
shell脚本编程学习第九天 I、文件内容如下: 123abc456 456def123 567abc789 789def567 要求输出: 456ABC123 123DEF456 789ABC567 567DEF789 sed 's/\([0-9]*\)\([a-z]*\)\([0-9]*\)/\3\U\2\E\1/' file3.txt **sed:**用于编译一个或者多个文件。功能挺强大,一点点学吧。 功能:s 是取代的意思,s/旧的/新的(这不是参数 不用-s,新的内容是空的话,可以当成删除
2021-02-07 14:35:48
42
原创 2021-02-04
shell脚本编程学习第八天 H、192.168.1.1 /hello1/b.do?bb=4 192.168.1.2 /hello2/a.do?ha=3 192.168.1.3 /hello3/r.do?ha=4 如何显示成以下效果 192.168.1.1 b.do 192.168.1.2 a.do 192.168.1.3 r.do #!/bin/bash array=( "92.168.1.1 /hello1/b.do?bb=4" "192.168.1.2 /hello2/a.do?ha=3" "192.
2021-02-04 21:37:54
37
原创 2021-02-02
shell脚本编程学习第七天 G、the squid project provides a number of resources to assist users design,implement and support squid installations. Please browse the documentation and support sections for more infomation,by oldboy training. https://www.jianshu.com/p/2241e
2021-02-02 20:26:47
56
原创 2021-01-23
shell脚本编程学习第六天 F、利用 bash for 循环打印下面这句话中字母数不大于 6 的单词(某企业面试真题)。 I am oldboy teacher welcome to oldboy training class(或者输入的一句话) #!/bin/bash arr=(I am oldboy teacher welcome to oldboy training class) for world in ${arr[*]} do if [ ${#world} -le 6 ] //再次强调
2021-01-23 16:49:58
67
原创 2021-01-21
shell脚本编程学习第五天 E、猜数字游戏。首先让系统随机生成一个数字,给这个数字定一个范围(1-60), 让用户输入猜的数字,对输入进行判断,如果不符合要求,就给予高或低的提示,猜对后则给出猜对用的次数。 #!/bin/bash game(){ read val if [[ ! $val =~ ^[0-9]+$ ]]; // 用[[ ]] 装判断条件的时候,千万有空格啊,又一次犯错了。 then echo "wrong input, please input number" exit
2021-01-21 22:16:17
99
2
原创 2021-01-20
shell脚本编程学习第四天 D、编写一个shell脚本,打印任何数的乘法表。 例如,如果你执行此脚本,它应请求一个数,并显示它的表。显示例输出如下: 2 2 x 1 = 2 … 2 x 9 = 18 #!/bin/bash echo "please enter a number" read num for ((i=1;i<=9;i++)) do res=$[$num*$i] echo "$num * $i = $res" done 该题还行吧,算是把前面的一些知识点用了一下。 .
2021-01-20 16:40:03
71
原创 2021-01-19
shell脚本编程学习第三天 C、写个shell脚本来把字符串反过来显示。 例如:给定12345 输出54321 #!/bin/bash echo "enter your string " read str echo $str|rev 遇到的问题: rev : 将文件中的每行内容以字符为单位反序输出。 cat file 输出为正序, cat test.sh =》123456 rev file 输出每一行都是反序。 rev test.sh =》654321 ...
2021-01-19 21:46:18
38
原创 2021-01-18
shell脚本编程学习第二天 B、编写一个脚本,它能够显示: 序列前10个数字:0、1、1、2、3、5、8、13、… 代码编写: #!/bin/bash res[0]=0 res[1]=1 for ((count=2;count<10;count++)) do res[count]=count]=count]=[KaTeX parse error: Expected '}', got 'EOF' at end of input: {res[count-1]}+KaTeX parse error: Ex
2021-01-18 17:48:34
67
原创 2021-01-16
shell 脚本编程学习第一天 练习题目1: A、编写一个脚本,显示下面菜单: Display list of all users currently logged in Get help on a particular command Press <Ctrl+D> to exit 如果选择1,显示当前登录的用户信息;若选择2,要求从键盘上输入一个命令名,并显示该命令的帮助信息;如果没有数据输入,脚本要先显示错误并退出。 代码: #!/bin/bash echo “1. Display li
2021-01-16 12:06:20
165
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人