Shell 脚本 while read 与 ssh 组合使用

现象while read 与 ssh 搭配使用时,只执行了一次循环体,第二次直接退出了192.168.111.101 192.168.111.101 192.168.111.101#!/bin/bash # date.sh while read ip do echo -n "$ip: " ssh $ip "date" done < ip.listbash date.sh 192.168.111.101: Wed Apr 19 18:22:57 CST 2023 bash -x date...

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: ...

CentOS 6 安装部署 noVNC

kickstart 构建 checkra1n.iso (Live CD)

下载 ckeckra1nwget -o /root/checkra1n https://assets.checkra.in/downloads/linux/cli/x86_64/xxxx/checkra1n挂载 CentOS 7 镜像# 挂载镜像,用作本地 yum 源,无需联网下载软件包,如果需要 uefi 启动,则略过此步,使用官方源,就是比较慢 mkdir /mnt/iso mount /dev/cdrom /mnt/iso加密 root 密码openssl passwd -1 "password" $1$vPq2UabN$...