当前位置:网站首页>【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 $*
边栏推荐
- The University of Göttingen proposed CLIPSeg, a model that can perform three segmentation tasks at the same time
- MSRA proposes extreme masking model ExtreMA for learning instances and distributed visual representations
- 【论文阅读-表情捕捉】ExpNet: Landmark-Free, Deep, 3D Facial Expressions
- 六步搞定子网划分
- 关于使用QML的MediaPlayer实现视频和音频的播放时遇到的一些坑
- ECCV2022 | RU&谷歌提出用CLIP进行zero-shot目标检测!
- Web Component-处理数据
- 网工必用神器:网络排查工具MTR
- 基于Flink CDC实现实时数据采集(一)-接口设计
- 通过Flink-Sql将Kafka数据写入HDFS
猜你喜欢
![[Go through 9] Convolution](/img/84/e6d99793aacf10a7b099f60bcaf290.png)
[Go through 9] Convolution

【数据库和SQL学习笔记】9.(T-SQL语言)定义变量、高级查询、流程控制(条件、循环等)

CVPR 2022 | 70% memory savings, 2x faster training

【Kaggle项目实战记录】一个图片分类项目的步骤和思路分享——以树叶分类为例(用Pytorch)

Thread handler句柄 IntentServvice handlerThread
![[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)

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

读论文- pix2pix

flink yarn-session的两种使用方式

单变量线性回归
随机推荐
AIDL detailed explanation
[Over 17] Pytorch rewrites keras
You should write like this
ECCV2022 | RU&谷歌提出用CLIP进行zero-shot目标检测!
IT系统运行维护方法及策略
【Pytorch学习笔记】8.训练类别不均衡数据时,如何使用WeightedRandomSampler(权重采样器)
[Skill] Long-term update
【22李宏毅机器学习】课程大纲概述
基于STM32F407的WIFI通信(使用的是ESP8266模块)
flink on yarn 集群模式启动报错及解决方案汇总
[Kaggle project actual combat record] Steps and ideas sharing of a picture classification project - taking leaf classification as an example (using Pytorch)
Tensorflow踩坑笔记,记录各种报错和解决方法
如何跟踪网络路由链路&检测网络健康状况
Spark ML学习相关资料整理
Flink EventTime和Watermarks案例分析
怎样在Disciples门徒获得收益?
flink基本原理及应用场景分析
如何编写一个优雅的Shell脚本(一)
Web Component-处理数据
读论文 - Unpaired Portrait Drawing Generation via Asymmetric Cycle Mapping