Centos系列:shell编程综合练习(个人学习记录)

shell编程综合练习(个人学习记录)

    • shell编程
      • until 循环
      • 跳出循环
        • 1. break命令
        • 2. continue 命令
    • Shell函数
      • 特殊变量
      • 输入输出重定向
          • 输出重定向
          • 输入重定向
          • 重定向
    • Shell实战
      • 监控centos7运行状态
      • /proc/stat文件
      • 编写脚本
      • free命令监控系统内存




shell编程

until 循环

until 循环执行一系列命令直至条件为 true 时停止。until 循环与 while 循环在处理方式上刚好相反。一般while循环优于until循环,但在某些时候,也只是极少数情况下,until 循环更加有用

# until 循环格式为:
   until command
   do
   Statement(s) to be executed until command is true
   done


# command 一般为条件表达式,如果返回值为 false,则继续执行循环体内的语句,否则跳出循环


# 例 使用 until 命令输出 0 ~ 9 的数字:

[root@localhost test]# vim until.sh
[root@localhost test]# cat until.sh
#!/bin/bash
a=0
until [ ! $a -lt 10 ]
do
        echo $a
        a=`expr $a + 1`
done
[root@localhost test]# chmod +x until.sh
[root@localhost test]# sh until.sh
0
1
2
3
4
5
6
7
8
9

跳出循环

在循环过程中,有时候需要在未达到循环结束条件时强制跳出循环,像大多数编程语言一样,Shell也使用 break 和 continue 来跳出循环

1. break命令

break命令允许跳出所有循环(终止执行后面的所有循环)

# 例:脚本进入死循环直至用户输入数字大于5。要跳出这个循环,返回到shell提示符下,就要使用break命令

# 代码如下:
[root@localhost test]# vim break.sh
[root@localhost test]# chmod +x break.sh
[root@localhost test]# cat break.sh
#!/bin/bash
while :
do
        echo -n "Input a number between 1 to 5: "
        read aNum
        case $aNum in
                1|2|3|4|5) echo "Your number is $aNum!"
                ;;
                *) echo "You do not select a number between 1 to 5,game is over !"
                   break
                ;;
        esac
done

# 运行效果如下: 
[root@localhost test]# sh break.sh
Input a number between 1 to 5: 1
Your number is 1!
Input a number between 1 to 5: 2
Your number is 2!
Input a number between 1 to 5: 3
Your number is 3!
Input a number between 1 to 5: 4
Your number is 4!
Input a number between 1 to 5: 5
Your number is 5!
Input a number between 1 to 5: 6
You do not select a number between 1 to 5,game is over !

# 在嵌套循环中,break 命令后面还可以跟一个整数,表示跳出第几层循环。
#例如:
break n
表示跳出第 n 层循环

# 代码如下
[root@localhost test]# vim break-2.sh
[root@localhost test]# chmod +x break-2.sh
[root@localhost test]# cat break-2.sh
#!/bin/bash
for var1 in 1 2 3
do
        for var2 in 0 5
        do
                if [ $var1 -eq 2 -a $var2 -eq 0 ]
                then
                        break 2
                else
                        echo "$var1 $var2"
                fi
        done
done

# 运行结果如下
[root@localhost test]# sh break-2.sh
1 0
1 5

2. continue 命令

continue命令与break命令类似,只有一点差别,它不会跳出所有循环,仅仅跳出当前循环

# 例:
# 代码入下:
[root@localhost test]# vim continue.sh
[root@localhost test]# chmod +x continue.sh
[root@localhost test]# cat continue.sh
#!/bin/bash
while :
do
        read -p "Input a number between 1 to 5: " aNum
        case $aNum in
                1|2|3|4|5) echo "Your number is $aNum!"
                ;;
                *) echo "You do not select a number between 1 to 5!"
                        continue
                        echo "Game is over!"
                ;;
        esac
done

# 运行效果如下:
[root@localhost test]# sh continue.sh
Input a number between 1 to 5: 1
Your number is 1!
Input a number between 1 to 5: 2
Your number is 2!
Input a number between 1 to 5: 8
You do not select a number between 1 to 5!
Input a number between 1 to 5: 5
Your number is 5!
Input a number between 1 to 5: 8
You do not select a number between 1 to 5!
Input a number between 1 to 5: 9
You do not select a number between 1 to 5!
Input a number between 1 to 5: ^C
[root@localhost test]#

# 运行代码发现,当输入大于5的数字时,该例中的循环不会结束,语句
echo "Game is over!"
永远不会被执行

Shell函数

函数可以让我们将一个复杂功能划分成若干模块,让程序结构更加清晰,代码重复利用率更高。像其他编程语言一样,Shell 也支持函数。Shell 函数必须先定义后使用

# Shell 函数的定义格式如下:

function_name  ( ) {

  list of commands

  [ return value ]

}
  • 函数返回值,可以显式增加return语句;如果不加,会将最后一条命令运行结果作为返回值

  • Shell 函数返回值只能是整数,一般用来表示函数执行成功与否,0表示成功,其他值表示失败

  • 在Shell中,调用函数时可以向其传递参数。在函数体内部,通过 $n 的形式来获取参数的值,例如,$1表示第一个参数,$2表示第二个参数…

# 例:代码如下

[root@localhost test]# vim funWithParam
[root@localhost test]# chmod +x funWithParam
[root@localhost test]# cat funWithParam
#!/bin/bash
funWithParam(){
        echo "The value of the first parameter is $1 !"
        echo "The value of the second parameter is $2 !"
        echo "The value of the tenth parameter is $10 !"
        echo "The value of the tenth parameter is ${10} !"
        echo "The value of the eleventh parameter is ${11} !"
        echo "The amount of the  parameter is $# !"
        echo "The string of the  parameter is $* !"
}

# 运行如下:
[root@localhost test]# source funWithParam
[root@localhost test]# funWithParam 1 2 3 5 6 7 4 20 21
The value of the first parameter is 1 !
The value of the second parameter is 2 !
The value of the tenth parameter is 10 !
The value of the tenth parameter is  !
The value of the eleventh parameter is  !
The amount of the  parameter is 9 !
The string of the  parameter is 1 2 3 5 6 7 4 20 21 !


特殊变量

在这里插入图片描述

输入输出重定向

从标准输入设备(stdin)获取输入,将结果输出到标准输出设备(stdout)显示。一般情况下,标准输入设备就是键盘,标准输出设备就是终端,即显示器

输出重定向

命令的输出不仅可以是显示器,还可以很容易的转移向到文件,这被称为输出重定向

# 例:
[root@localhost test]# who
root     pts/0        2023-03-25 09:00 (192.168.180.1)
[root@localhost test]# who > username.txt
[root@localhost test]# cat username.txt
root     pts/0        2023-03-25 09:00 (192.168.180.1)

# 注意:
 >   输出重定向会覆盖文件内容
 >>  输出重定向追加到文件末尾
 
 # 追加
[root@localhost test]# pwd >> username.txt
[root@localhost test]# cat username.txt
root     pts/0        2023-03-25 09:00 (192.168.180.1)
/root/test
输入重定向
# 格式
command  <  file


# 例:计算 username文件中的行数

[root@localhost test]# wc -l < username.txt
2
重定向
  • 一般情况下,每个 Unix/Linux 命令运行时都会打开三个文件:

  • 标准输入文件(stdin):stdin的文件描述符为0,Unix程序默认从stdin读取数据。

  • 标准输出文件(stdout):stdout 的文件描述符为1,Unix程序默认向stdout输出数据。

  • 标准错误文件(stderr):stderr的文件描述符为2,Unix程序会向stderr流中写入错误信息。

1.默认情况下,command  >  file 将 stdout 重定向到 file,command  < file 将stdin 重定向到 file
# 如果希望 stderr 重定向到 file,可以这样写:
$command 2 > file

# 如果希望 stderr 追加到 file 文件末尾,可以这样写:
$command 2 >> file
2 表示标准错误文件(stderr)

# 如果希望将 stdout 和 stderr 合并后重定向到 file,可以这样写:
$command >> file 2>&1
或
$command > file 2>&1

# 如果希望执行某个命令,但又不希望在屏幕上显示输出结果,那么可以将输出重定向到 /dev/null:
$ command > /dev/null

# 如果希望屏蔽 stdout 和 stderr,可以这样写:
command > /dev/null 2>&1


# /dev/null: 表示 的是一个黑洞,通常用于丢弃不需要的数据输出, 或者用于输入流的空文件

# 例:将无用的输出流写入到黑洞丢弃。错误信息定位到黑洞curl -l  www.baidu.com 2>/dev/null 
将标准输出信息定位输出到/dev/null黑洞
curl -l www.baidu.com 1> /dev/null 


# 在书写定时任务,规范的写法就是将所有定时任务脚本结尾加上>/dev/null 2>&1,让所有的输出流(包括错误的和正确的)都定向到空设备丢弃。例:
 00 01 * * * /bin/sh/server/scripts/mysqlbak.sh  >/dev/null  2>&1


Shell实战

监控centos7运行状态

利用vmstat工具监控CPU详细信息,然后基于/proc/stat计算CPU利用率进行监控,超过80报警并提取出占用cpu最高的前十进程

vmstat是Linux系统监控工具,使用vmstat命令可以得到关于进程、内存、内存分页、堵塞IO、traps及CPU活动的信息

在这里插入图片描述

  • r:运行队列中的进程数;

  • b:等待IO的进程数

  • swpd:已用虚拟内存大小(k);free:空闲内存大小;buff:已用缓冲大小;cache:已用缓存大小。

  • si:每秒从交换区写入内存的大小(kb/s);

  • so:每秒从内存写入交换分区的大小

  • bi:每秒读取的块数;bo每秒写入的块数。

  • in:每秒中断数,包括时钟中断;cs:每秒上下文切换数。

  • us(user time):用户进程执行消耗cpu时间;

  • sy(system time):系统进程执行消耗cpu时间;

  • id:空闲时间(包括IO等待时间);

  • wa:等待IO时间。

/proc/stat文件

该文件包含了所有CPU活动的信息,该文件中的所有值都是从系统启动开始累计到当前时刻。可以利用其中信息计算cpu的利用率

[root@localhost test]# cat /proc/stat
cpu  372 0 1266 2494149 125 0 25 0 0 0
cpu0 70 0 492 623135 14 0 15 0 0 0
cpu1 136 0 316 623496 96 0 6 0 0 0
cpu2 79 0 212 623795 8 0 1 0 0 0
cpu3 86 0 246 623722 6 0 2 0 0 0
intr 525088 73 10 0 0 0 0 0 0 1 0 0 0 16 0 0 6218 2800 8124 68 13796 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 797 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0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t 896071
btime 1679705900
processes 1729
procs_running 1
procs_blocked 0
softirq 312789 1 121008 1253 13800 11060 0 873 100236 0 64558

编写脚本

[root@localhost test]# vim vmstat.sh
[root@localhost test]# chmod +x vmstat.sh

# 代码如下:
[root@localhost test]# cat vmstat.sh
#!/bin/bash
CPU_us=$(vmstat | awk '{print $13}' | sed -n '$p')
CPU_sy=$(vmstat | awk '{print $14}' | sed -n '$p')
CPU_id=$(vmstat | awk '{print $15}' | sed -n '$p')
CPU_wa=$(vmstat | awk '{print $16}' | sed -n '$p')
CPU_st=$(vmstat | awk '{print $17}' | sed -n '$p')

CPU1=`cat /proc/stat | grep 'cpu' | awk '{print $2" " $3" " $4" " $5" " $6" "$7" "$8}'`
sleep 5
CPU2=`cat /proc/stat | grep 'cpu' | awk '{print $2" " $3" " $4" " $5" " $6" "$7" "$8}'`
IDLE1=`echo $CPU1 | awk '{print $4}'`
IDLE2=`echo $CPU2 | awk '{print $4}'`
CPU1_TOTAL=`echo $CPU1 | awk '{print $1+$2+$3+$4+$5+$6+$7}'`
CPU2_TOTAL=`echo $CPU2 | awk '{print $1+$2+$3+$4+$5+$6+$7}'`
IDLE=`echo "$IDLE2-$IDLE1" | bc`
CPU_TOTAL=`echo "$CPU2_TOTAL - $CPU1_TOTAL" | bc`
RATE=`echo "scale=4;($CPU_TOTAL-$IDLE)/$CPU_TOTAL*100" | bc | awk '{printf "%.2f",$1}'`
echo -e "us=$CPU_us\tsy=$CPU_sy\tid=$CPU_id\twa=$CPU_wa\tst=$CPU_st"
echo "CPU_RATE:${RATE}%"
CPU_RATE=`echo $RATE | cut -d. -f1`
if  [ $CPU_RATE -ge 80 ]
then    echo "CPU Warn"
        ps aux | grep -v USER | sort -rn -k3 | head
fi


# 运行效果如下

[root@localhost test]# sh vmstat.sh
us=0    sy=0    id=100  wa=0    st=0
CPU_RATE:0.04%
[root@localhost test]#

free命令监控系统内存

[root@localhost test]# vim free.sh
[root@localhost test]# chmod +x free.sh

# 代码如下:
[root@localhost test]# cat free.sh
#!/bin/bash
total=$(free -m | sed -n '2p' | awk '{print $2}')
used=$(free -m | sed -n '2p' | awk '{print $3}')
free=$(free -m | sed -n '2p' | awk '{print $4}')
shared=$(free -m | sed -n '2p' | awk '{print $5}')
buff=$(free -m | sed -n '2p' | awk '{print $6}')
cached=$(free -m | sed -n '2p' | awk '{print $7}')
rate=`echo "scale=2;$used/$total" | bc | awk -F. '{print $2}'`
echo -e "total\tused\tfree\tshared\tbuffer\tavailable"
echo -e "${total}M\t${used}M\t${free}M\t${shared}M\t${buff}M\t${cached}M\nrate:${rate}$"
if      [ $rate -ge 80 ]
then    echo "Memory Warn"
    ps aux | grep -v USER | sort -rn -k4 | head
fi



# 运行如下:
[root@localhost test]# sh free.sh
total   used    free    shared  buffer  available
1819M   222M    1339M   9M      256M    1447M
rate:12$







喜欢水星记

shell编程综合练习(个人学习记录)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/215966.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

【已解决】xxljob连接报错HTTP 302(HTTP 401账号或密码错误)

目录 问题现象&#xff1a; 问题分析&#xff1a; 1、密码中的特殊字符。 2、密码长度问题。 解决方法&#xff1a; 拓展&#xff1a; 问题现象&#xff1a; 今天在生产环境使用xxljob任务调度来创建并执行任务时&#xff0c;出现了程序报错&#xff1a; 通过查询xxljob日志…

Java集合(已重写-废弃了)

# 精辟总结 其实各种八股文资料&#xff0c;他也就是围绕着核心知识展开提问的&#xff0c;你只要根据八股文把核心知识提炼出来&#xff0c;形成核心知识体系&#xff01; Java集合那是重点中的重点。最基本的概念要懂&#xff0c;核心的概念&#xff0c;那要滚瓜烂熟。 Ja…

TEMU跨境平台与亚马逊检测认证几大认证您知道多少?

TEMU跨境平台与亚马逊检测认证几大认证您知道多少&#xff1f; TEMU跨境平台与亚马逊对于做外贸的人应该都不陌生,可是你是否知道产品入驻TEMU跨境平台与亚马逊需要办理的13大认证呢?如果你不知道,请认真阅读正面的内容,因为它关系着你的产品能否在TEMU跨境平台与亚马逊顺利上…

Cookie、Session、Token

Cookie 什么是Cookie Cookie是服务器发送给客户端并保存在客户端本地的一小块数据&#xff0c;能够在下次发送请求时携带Cookie。 Cookie是保存在客户端的&#xff0c;按存储位置分类&#xff0c;可以分为内存Cookie和硬盘Cookie。 Cookie的应用 Cookie主要用于几个方面&a…

vite的使用

vite说是面向未来的框架&#xff0c;支持esm模块化&#xff0c;虽然可以引入require插件来支持&#xff0c;commomjs不过介意别用&#xff0c;因为老旧的包和node版本问题也很多&#xff0c;对应升级的生态nuxt3和新的需要更新node版本18 20&#xff0c; 通常搭建vite就是引入l…

ROS第一个程序——helloworld

目录 一、工作空间的创建 1.创建工作空间并初始化 2.进入 src 创建 ros 包并添加依赖 二、C实现helloworld C源码实现 编辑 ros 包下的 Cmakelist.txt文件 进入工作空间目录并编译 执行 三、python实现helloworld 进入 ros 包添加 scripts 目录并编辑 python 文件 …

【源码篇】基于SpringBoot+thymeleaf实现的蓝天幼儿园管理系统

基于SpringBootthymeleaf实现的蓝天幼儿园管理系统 文章目录 系统说明技术选型成果展示账号地址及其他说明 系统说明 基于SpringBootthymeleaf实现的蓝天幼儿园管理系统是为幼儿园提供的一套管理平台&#xff0c;可以提高幼儿园信息管理的准确性&#xff0c;系统将信息准确无误…

883重要知识点

&#xff08;1&#xff09;程序结构分三种&#xff1a;顺序结构&#xff0c;选择结构&#xff0c;循环结构。 &#xff08;2&#xff09;该程序都要从main&#xff08;&#xff09;开始&#xff0c;然后从最上面往下。 &#xff08;3&#xff09;计算机的数据在电脑中保存以二…

vue+ts实现离线高德地图 内网离线高德地图

1、下载瓦片 我是用最简单的软件下载——MapDownloader 链接&#xff1a;https://pan.baidu.com/s/1Hz__HcA5QhtGmjLNezC_pQ 提取码&#xff1a;6lek 来源&#xff1a;https://blog.csdn.net/fuhanghang/article/details/131330034 2、部署私有化瓦片资源 这里也是用最简单的…

智能变压器监控系统

智能变压器监控系统是一种先进的物联网技术和智能设备&#xff0c;能够实现对变压器的实时监测和管理&#xff0c;提高变压器的运行效率和可靠性&#xff0c;为用户提供及时、准确的变压器运行状态信息和故障预警。 力安科技A30变压器云控终端是一款集变压器温控仪、变压器运行…

【每日一题】从二叉搜索树到更大和树

文章目录 Tag题目来源题目解读解题思路方法一&#xff1a;中序遍历的反序方法二&#xff1a;后缀数组 写在最后 Tag 【中序遍历】【二叉树】【2023-12-04】 题目来源 1038. 从二叉搜索树到更大和树 题目解读 在二叉搜索树中&#xff0c;将每一个节点的值替换成树中大于等于该…

百度查询界面自定义

文章目录 起因步骤 纯个人纪录 参考以下师傅链接 爱吃猫的鱼儿-浏览器设置夜间模式以及百度搜索结果单列居中 起因 发现百度查询结果都在左边&#xff0c;想着能不能居中&#xff0c;发现已经有前辈写了插件&#xff0c;遂安装使用&#xff0c;看下效果 步骤 安装插件暴力猴…

计算机基础知识63

Django的条件查询&#xff1a;查询函数 exclude exclude&#xff1a;返回不满足条件的数据 res Author.objects.exclude(pk1) print(res) # <QuerySet [<Author: Author object (2)>, <Author: Author object (3)>]> order_by 1、按照 id 升序排序 res …

Android启动系列之进程杀手--lmkd

本文概要 这是Android系统启动的第三篇文章&#xff0c;本文以自述的方式来讲解lmkd进程&#xff0c;通过本文您将了解到lmkd进程在安卓系统中存在的意义&#xff0c;以及它是如何杀进程的。&#xff08;文中的代码是基于android13&#xff09; 我是谁 init&#xff1a;“大…

LeetCode 232.用栈实现队列

题目 请你仅使用两个栈实现先入先出队列。队列应当支持一般队列支持的所有操作&#xff08;push、pop、peek、empty&#xff09;&#xff1a; 实现 MyQueue 类&#xff1a; void push(int x) 将元素 x 推到队列的末尾 int pop() 从队列的开头移除并返回元素 int peek() 返回…

c题目14:写成一个函数,对数组进行排序

每日小语 一个人倘若需要从思想中得到快乐&#xff0c;那么他的第一个欲望就是学习。——王小波 自己思考 这不前几天刚搞的东西吗&#xff0c;就写成一个函数&#xff0c;这个有什么难的吗&#xff1f;我有时候那个分别心特重啊&#xff0c;真就别人拿到个啥好的比杀了我还难…

贸易公司ERP用什么软件好

不同行业的贸易公司有不同的业务结构和管理模式&#xff0c;日常经营管理过程中遇到的难点呈现多样化&#xff0c;而很多贸易公司在仓库、财务、销售、采购、订单、客户等业务一体化和部门协同效率等方面还有很多提升空间。 有些贸易公司涉及多仓库、多门店、多税制、多汇率、…

VUE2+THREE.JS 设定巡航行动轨迹

设定巡航行动轨迹 引入three.path初始化坐标点animate 执行行动轨迹动画参考博客 我们写3D时&#xff0c;常常会有按照一定轨迹去浏览模型&#xff0c; 所以,我们要先确认行动轨迹&#xff0c;渲染出行动轨迹以后&#xff0c;再让人物按照行动轨迹去移动 引入three.path cnpm …

性价比开放式蓝牙耳机推荐哪款、性价比最高的开放式耳机

传统的耳机设计虽然便携&#xff0c;但却可能给一些需要长时间佩戴的用户带来不适。长时间封闭在耳机内可能导致耳朵不透气&#xff0c;甚至引起疼痛。这就是为什么近年来开放式耳机越来越受欢迎的原因。这种耳机设计无需直接插入耳道&#xff0c;采用挂耳的佩戴方式&#xff0…

广州数字孪生赋能工业制造,加速推进制造业数字化转型

广州数字孪生赋能工业制造&#xff0c;加速推进制造业数字化转型。数字孪生系统基于历史数据、实时数据&#xff0c;采用人工智能、大数据分析等新一代信息技术对物理实体的组成、特征、功能和性能进行数字化定义和建模。通过构建在信息世界对物理实体的等价映射&#xff0c;对…