当前位置:网站首页>【shell编程】第三章:函数
【shell编程】第三章:函数
2022-08-05 05:16:00 【六月的可乐】
提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档
函数
一、函数的知识点

二、语句语法


二、案例脚本
1、函数实现检测网站通畅的脚本
#!/bin/bash
######
lsb_function="/lib/lsb/init-functions"
if test -f $lsb_function; then
. $lsb_function
else
init_functions="etc/init.d/functions"
if test -f $init_functions;then
. $init_function
fi
log_success_msg() {
echo "success![email protected]"
}
log_failure_msg(){
echo "ERROR![email protected]"
}
#####
## 定义错误提示函数
function usages(){
echo "usage:$0 url"
exit 1
}
# 定义检查的函数
check(){
wget --spider -q -o /dev/null --tries=1 -T 5 $1
if [ $? -ne 0 ];then
echo "$1 is running..."
else
echo "$1 is down..."
fi
}
# 入口函数
main() {
[[ $# -ne 1 ]] && {
uasges
}
check
}
main $*
边栏推荐
猜你喜欢

【Multisim仿真】直流稳压电源设计报告

Thread handler句柄 IntentServvice handlerThread

【数据库和SQL学习笔记】5.SELECT查询3:多表查询、连接查询

【论文精读】Rich Feature Hierarchies for Accurate Object Detection and Semantic Segmentation(R-CNN)

【22李宏毅机器学习】课程大纲概述

神经网络也能像人类利用外围视觉一样观察图像
![[Database and SQL study notes] 8. Views in SQL](/img/22/82f91388f06ef4f9986bf1e90800f7.png)
[Database and SQL study notes] 8. Views in SQL

flink yarn-session的两种使用方式

MaskDistill - Semantic segmentation without labeled data

物联网:LoRa无线通信技术
随机推荐
flink中文文档-目录v1.4
Flink HA配置
数控直流电源
[Skill] Long-term update
Kubernetes常备技能
全尺度表示的上下文非局部对齐
dataframe 常用操作
OSPF故障排除办法
华科提出首个用于伪装实例分割的一阶段框架OSFormer
[After a 12] No record for a whole week
用GAN的方法来进行图片匹配!休斯顿大学提出用于文本图像匹配的对抗表示学习,消除模态差异!
[Pytorch study notes] 11. Take a subset of the Dataset and shuffle the order of the Dataset (using Subset, random_split)
Mysql-连接https域名的Mysql数据源踩的坑
[Practice 1] Diabetes Genetic Risk Detection Challenge [IFLYTEK Open Platform]
【论文精读】R-CNN 之预测框回归(Bounding box regression)问题详述
BFC详解(Block Formmating Context)
【22李宏毅机器学习】课程大纲概述
Detailed explanation of BroadCast Receiver (broadcast)
6k+ star,面向小白的深度学习代码库!一行代码实现所有Attention机制!
It turns out that the MAE proposed by He Yuming is still a kind of data enhancement