Linux 脚本:计算当前时间与目标时间差
#!/bin/bash
获取当前时间戳
now=$(date +%s)
将传入的时间参数转换为时间戳
target=$(date -d '$1' +%s)
计算差值
diff=$((target-now))
echo '距离目标时间还有 $diff 秒'
原文地址: https://www.cveoy.top/t/topic/nmoW 著作权归作者所有。请勿转载和采集!
安全问答是一个知识全球问答,包含丰富的问答知识
#!/bin/bash
now=$(date +%s)
target=$(date -d '$1' +%s)
diff=$((target-now))
echo '距离目标时间还有 $diff 秒'
原文地址: https://www.cveoy.top/t/topic/nmoW 著作权归作者所有。请勿转载和采集!