十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析

20.16shell中的函数

十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析

打印参数的函数

十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析

十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析

第一个方框里是定义的函数(function可以不用写),第二个方框里是调用,后面的1a2是它的参数。

十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析

十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析

十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析

十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析

20.17 shell中的函数

十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析

定义一个加法函数(调用函数语句必须要在之前定义函数)

十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析

显示ip的函数:(输入网卡的名字显示网卡的ip)

十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析

十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析显示ens33网卡的第一行及下面一行。(不要忘了有空格的)

十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析

十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析匹配inet然后取第二段

十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析

20.18 shell中的数组

十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析

十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析

十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析定义数组

十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析显示数组所有内容

十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析查看数组中的第0个元素,(计算机中是从0开始记数的,所以0也就是第一个)

 

十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析获取数组的个数。

十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析给数字的第四个附值为a,十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析(更改元素也是同样的方法)

十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析删除其中一个元素,十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析删除数组的所有元素。

数组分片

十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析创建数组

十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析截取第3位后面的4个,(第3个后面的4个也就是4-7,然后一共四个)

十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析截取包括倒数第三个往后的两个

十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析把8改成6

十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析永久把8改成6

20.19 告警系统需求分析

十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析

十六周四次课 2018.02.08 shell中的函数、shell中的数组、告警系统需求分析