好的,愚蠢的新手问题。我以为我正在制作倒计时计时器。应该从5点计数,一旦在0处,然后执行回声"时间是小丑",然后结束。我在这里做错了什么?
seconds=5
date1=$((`date +%s` + $seconds));
while [ "$date1" -ne `date +%s` ]; do
if (!$date1 -lt ((`date +%s` + $seconds)+1)); then
echo "time is up clown";
break;
fi;
echo -ne "$(date -u --date @$(($date1 - `date +%s` )) +%H:%M:%S)r";
done
#!/bin/bash
SECS=5
while [[ 0 -ne $SECS ]]; do
echo "$SECS.."
sleep 1
SECS=$[$SECS-1]
done
echo "Time is up, clown."