Linux bash Timer
bash, if-statement, linux, while-loop
Solution
#!/bin/bash
SECS=5
while [[ 0 -ne $SECS ]]; do
echo "$SECS.."
sleep 1
SECS=$[$SECS-1]
done
echo "Time is up, clown."
Problem
Ok, stupid newbie question here. I thought I was making a countdown timer. This is supposed to count down from 5 and once it is at 0 then execute the echo "time is up clown" then end. What am I doing wrong here? ``` 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 ```