Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

# get user input
ZENITY1=$(zenity --entry --text '  1m:    60s\n  5m:   300s\n10m:   600s\n15m:   900s\n20m: 1200s\n25m: 1500s\n30m: 1800s\n35m: 2100s\n40m: 2400s\n45m: 2700s\n50m: 3000s\n55m: 3300s\n   1h: 3600s' --entry-text "Input only int in seconds!" --title "Timer")

# put starting date in variable

# audit/check user input
WAITINGTIME=$(echo $ZENITY1 | egrep "[0-9]{1,}" -o)
if [ "$WAITINGTIME" == "" ]; then exit 1; fi

# main stopwatch
for i in `seq $WAITINGTIME -1 1`; do echo $i | osd_cat -A left -p top -i 100 -c black -d 1; done

# time expired message
zenity --info --text="Time expired@\n$(date)\n\nStarted@\n$STARTTIME"

So this is the script that I have on my desktop. If I need to warn somebody for e.x.: "please warn me after 15 minutes". But if I use it in a longer time, e.x.: 12 hours it's not very accurate! it could get ~10 minutes difference to the real time... :\ Why is it?

share|improve this question
up vote 2 down vote accepted

If you find it takes consistently too long, I guess you're seeing the overhead of fourty-odd thousand executions of echo and osd_cat.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.