当前位置:网站首页>【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 $*
边栏推荐
猜你喜欢

CVPR best paper winner Huang Gao's team from Tsinghua University presented the first dynamic network review
![[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)

Tensorflow steps on the pit notes and records various errors and solutions

【论文阅读-表情捕捉】High-quality Real Time Facial Capture Based on Single Camera

面向小白的深度学习代码库,一行代码实现30+中attention机制。

【数据库和SQL学习笔记】6.SELECT查询4:嵌套查询、对查询结果进行操作

记我的第一篇CCF-A会议论文|在经历六次被拒之后,我的论文终于中啦,耶!

Flink HA配置

A deep learning code base for Xiaobai, one line of code implements 30+ attention mechanisms.

【Multisim仿真】直流稳压电源设计报告
随机推荐
如何停止flink job
[Database and SQL study notes] 9. (T-SQL language) Define variables, advanced queries, process control (conditions, loops, etc.)
数据库期末考试,选择、判断、填空题汇总
MSRA提出学习实例和分布式视觉表示的极端掩蔽模型ExtreMA
IDEA 配置连接数据库报错 Server returns invalid timezone. Need to set ‘serverTimezone‘ property.
读论文- pix2pix
沁恒MCU从EVT中提取文件建立MounRiver独立工程
vscode要安装的插件
SparkML-初探-文本分类
Web Component-处理数据
门徒Disciples体系:致力于成为“DAO世界”中的集大成者。
MaskDistill-不需要标注数据的语义分割
发顶会顶刊论文,你应该这样写作
网络信息安全运营方法论 (下)
拿出接口数组对象中的所有name值,取出同一个值
吞吐?带宽?傻傻分不清楚
关于使用QML的MediaPlayer实现视频和音频的播放时遇到的一些坑
Flink Broadcast 广播变量
Kubernetes常备技能
flink部署操作-flink standalone集群安装部署