当前位置:网站首页>【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 $*
边栏推荐
- 全尺度表示的上下文非局部对齐
- WCH系列芯片CoreMark跑分
- IJCAI 2022|边界引导的伪装目标检测模型BGNet
- [Intensive reading of the paper] R-CNN's Bounding box regression problem is detailed
- Web Component-处理数据
- 如何跟踪网络路由链路&检测网络健康状况
- 记我的第一篇CCF-A会议论文|在经历六次被拒之后,我的论文终于中啦,耶!
- ECCV2022 | RU&谷歌提出用CLIP进行zero-shot目标检测!
- 服务网格istio 1.12.x安装
- [Over 17] Pytorch rewrites keras
猜你喜欢

用GAN的方法来进行图片匹配!休斯顿大学提出用于文本图像匹配的对抗表示学习,消除模态差异!

伪RTOS-ProroThread在CH573芯片上的移植

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

IDEA 配置连接数据库报错 Server returns invalid timezone. Need to set ‘serverTimezone‘ property.

el-pagination左右箭头替换成文字上一页和下一页

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

Flink Broadcast 广播变量

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

flink on yarn 集群模式启动报错及解决方案汇总

IJCAI 2022|边界引导的伪装目标检测模型BGNet
随机推荐
MySQL
PoE视频监控解决方案
Web Component-处理数据
【零基础开发NFT智能合约】如何使用工具自动生成NFT智能合约带白名单可Mint无需写代码
六步搞定子网划分
You should write like this
基于Flink CDC实现实时数据采集(二)-Source接口实现
Service
CVPR 2022 | 70% memory savings, 2x faster training
面向小白的深度学习代码库,一行代码实现30+中attention机制。
SharedPreferences and SQlite database
Tensorflow steps on the pit notes and records various errors and solutions
神经网络也能像人类利用外围视觉一样观察图像
[Over 17] Pytorch rewrites keras
flink项目开发-配置jar依赖,连接器,类库
Flutter 3.0升级内容,该如何与小程序结合
A deep learning code base for Xiaobai, one line of code implements 30+ attention mechanisms.
Service
读论文 - Unpaired Portrait Drawing Generation via Asymmetric Cycle Mapping
Flink和Spark中文乱码问题