
shell
文章平均质量分 92
哈密瓜小贼
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
执行shell脚本的方法有哪些
1bash /data/scripts37/hello.sh2cat /data/scripts37/hello.sh | bash3/data/scripts37/hello.sh 加执行权限chmod +xcd /data/scripts37/./hello.sh4vim /etc/profile.d/env.shPATH=/data/scripts37/:$PATH原创 2020-05-23 22:56:39 · 110 阅读 · 0 评论 -
keepalived实战案例
1、编写脚本selinux.sh,实现开启或禁用SELinux功能path=/app/selinuxselinux=`sed -rn "/^(SELINUX=).*\$/p" $path`case $1 inenforcing|en) sed -ri "s@^(SELINUX=).*\$@\1enforcing@g" $path if [ $selin...原创 2020-04-27 22:16:16 · 343 阅读 · 0 评论 -
shell脚本案例-进阶
1、用RANDOM生成10个随机数,并输出最大值和最小值[root@centos7 scripts]#vim while_max_min.sh#!/bin/bashi=1MAX=$RANDOMMIN=$MAXecho $MAXwhile [ $i -lt 10 ];do N=$RANDOM echo $N if [ $N -gt $...原创 2020-04-15 22:20:27 · 367 阅读 · 0 评论 -
shell脚本案例-进阶(for循环)
1、 求和计算计算1+3+5+……+97+99=?[root@centos7 scripts]#vim for_sum.sh #!/bin/bashdeclare -i sum=0for i in {1..100..2};do ...原创 2020-04-09 23:34:46 · 531 阅读 · 0 评论 -
shell脚本案例-基础
1、创建用户2、查询本机系统信息3、每天将/etc/目录备份到/data/etc下4、位置变量及特殊变量5、位置变量中 `$*`与`$@`的区别6、实现远程传输7、用一个脚本代替rm8、磁盘分区利用率大于80%时报警9、read小案例10、算术题:鸡兔回笼11、请选择yes或no12、用 if 判断年龄原创 2020-04-03 19:09:19 · 277 阅读 · 0 评论