countdown/normal.sh
2025-04-15 15:32:22 +08:00

15 lines
277 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 计数从1开始到15结束
for i in {1..15}
do
# 计算还剩多少秒
remaining=$((15 - i + 1))
# 输出当前状态
echo "${i}秒,还有${remaining}秒退出..."
# 等待1秒
sleep 1
done
echo "计时结束,退出程序!"