当前位置:网站首页>【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 $*
边栏推荐
- Flink EventTime和Watermarks案例分析
- Flink Table API 和 SQL之概述
- 怎样在Disciples门徒获得收益?
- AIDL详解
- 【Pytorch学习笔记】9.分类器的分类结果如何评估——使用混淆矩阵、F1-score、ROC曲线、PR曲线等(以Softmax二分类为例)
- BFC详解(Block Formmating Context)
- dataframe 常用操作
- Thread handler句柄 IntentServvice handlerThread
- ECCV2022 | RU&谷歌提出用CLIP进行zero-shot目标检测!
- [Database and SQL study notes] 9. (T-SQL language) Define variables, advanced queries, process control (conditions, loops, etc.)
猜你喜欢

物联网-广域网技术之NB-IoT

神经网络也能像人类利用外围视觉一样观察图像

flink部署操作-flink standalone集群安装部署

CVPR2021 - Inception Convolution with Efficient Dilation Search

flink中文文档-目录v1.4
![[Kaggle project actual combat record] Steps and ideas sharing of a picture classification project - taking leaf classification as an example (using Pytorch)](/img/7d/7f1301c30034f1c247d41f04c40244.png)
[Kaggle project actual combat record] Steps and ideas sharing of a picture classification project - taking leaf classification as an example (using Pytorch)

PID详解

It turns out that the MAE proposed by He Yuming is still a kind of data enhancement

网络信息安全运营方法论 (下)

常见的 PoE 错误和解决方案
随机推荐
CVPR2020 - 自校准卷积
关于存储IOPS你必须了解的概念
六步搞定子网划分
SharedPreferences and SQlite database
表情捕捉的指标/图像的无参考质量评价
Tensorflow2 与 Pytorch 在张量Tensor基础操作方面的对比整理汇总
原来何恺明提出的MAE还是一种数据增强
如何编写一个优雅的Shell脚本(三)
AIDL详解
关于基于若依框架的路由跳转
The University of Göttingen proposed CLIPSeg, a model that can perform three segmentation tasks at the same time
ECCV2022 | RU & Google propose zero-shot object detection with CLIP!
通过Flink-Sql将Kafka数据写入HDFS
服务网格istio 1.12.x安装
dataframe 常用操作
IJCAI 2022|边界引导的伪装目标检测模型BGNet
网络信息安全运营方法论 (下)
BFC详解(Block Formmating Context)
SharedPreferences和SQlite数据库
el-pagination分页分页设置