shell 脚本 source 技巧

调用外部 Shell 脚本的函数及变量mkdir test && cd test touch {func,test}.sh chmod +x {func,test}.sh#!/bin/bash # func.sh function echo_color(){ local msg=$1 echo -e "\033[1;31m${msg}\033[0m" } func_var=123 echo 456#!/bin/bash # test.sh source func.sh echo_color $fu...

Shell 脚本检查 SSL 证书颁发时间、到期时间

script#!/bin/bash unset LANG domain_list=${domain_list:-$PWD/domain.list} log=${log:-false} timeout=${timeout:-10} timezone=${timezone:-Asia/Shanghai} author="<mail@zhuangzhuang,ml>" version=v1.0.1 update=2021-09-10 usage(){ cat <<EOF Usage: ...

学习使我快乐 - 实时查看网速

学习使我快乐 🤪下载地址: network-speed.shwget https://raw.githubusercontent.com/ydzydzydz/Shell/master/shell_22.sh -O /root/network_speed.sh && bash /root/network_speed.sh eth0#!/bin/bash #------------------------------ # 实时显示网速 #------------------------------ check_eth (){ ...

学习使我快乐 - 倒计时脚本

前段时间老师在课间运行了个倒计时十五分钟的脚本,就自己动手实现了一下可能方法有点蠢,但是好在能用最后,学习使我快乐 🤪下载地址: time.sh#!/bin/bash #------------------------------------ # 1.倒计时 # 2.计时器 # 3.时钟 #------------------------------------ # 计算[时、分、秒] SetHMS (){ Ling=0 if [ "$Miao" -ge 3600 ];then let Ho...