Countdown Clock

let T=$(date +%s)+3*60;while [ $(date +%s) -le $T ]; do let i=$T-$(date +%s); echo -ne "\r$(date -d"0:0:$i" +%H:%M:%S)"; sleep 0.3; done
I find the other timers are inaccurate. It takes some microseconds to perform the date function. Therefore, using date/time math to calculate the time for us results in millisecond accuracy. This is tailored to the BusyBox date function. May need to change things around for GNU date function.
Sample Output
00:03:00

-1
By: davidk
2019-10-22 15:04:21

4 Alternatives + Submit Alt

  • Simple countdown clock that should be quite portable across any Bourne-compatible shell. I used to teach for a living, and I would run this code when it was time for a break. Usually, I would set "MIN" to 15 for a 15-minute break. The computer would be connected to a projector, so this would be projected on screen, front and center, for all to see. Show Sample Output


    12
    MIN=1 && for i in $(seq $(($MIN*60)) -1 1); do echo -n "$i, "; sleep 1; done; echo -e "\n\nBOOOM! Time to start."
    atoponce · 2010-06-20 15:19:12 43
  • Countdown clock - Counts down from $MIN minutes to zero. I let the date command do the maths. This version doesn't use seq. Show Sample Output


    11
    MIN=10;for ((i=MIN*60;i>=0;i--));do echo -ne "\r$(date -d"0+$i sec" +%H:%M:%S)";sleep 1;done
    flatcap · 2011-02-20 11:56:28 7
  • The biggest advantage over atoponce's nifty original is not killing the scrollback. Written assuming bash, but shouldn't be terribly difficult to port to other shells. S should be multiple spaces, but I can't get commandlinefu to save/show them properly, any help?


    1
    function countdown { case "$1" in -s) shift;; *) set $(($1 * 60));; esac; local S=" "; for i in $(seq "$1" -1 1); do echo -ne "$S\r $i\r"; sleep 1; done; echo -e "$S\rBOOM!"; }
    kniht · 2010-06-30 12:20:01 1

  • 0
    MIN=10 && for i in $(seq $(($MIN*60)) -1 1); do printf "\r%02d:%02d:%02d" $((i/3600)) $(( (i/60)%60)) $((i%60)); sleep 1; done
    bugmenot · 2011-02-20 10:24:22 0

What Others Think

does not work... let T=$(date +%s)+3*60;while [ $(date +%s) -le $T ]; do let i=$T-$(date +%s); echo -ne "\r$(date -d"0:0:$i" +%H:%M:%S)"; sleep 0.3; done date: date «0:0:180» incorrecte date: date «0:0:180» incorrecte date: date «0:0:180» incorrecte date: date «0:0:179» incorrecte date: date «0:0:179» incorrecte date: date «0:0:179» incorrecte date: date «0:0:179» incorrecte date: date «0:0:178» incorrecte
_xX0V0Xx_ · 105 weeks and 4 days ago
are there any recent updates with hair extensions pittsburgh?
looneyhans · 60 weeks and 6 days ago
Awesome blog by the way and thanks for sharing! baby photography
idasanka · 56 weeks and 1 day ago
private investigator tallahassee Whoa! I just can't believe I found this site
yeoyeo · 54 weeks and 4 days ago
love the idea! soo glad i found this site! fly
sammm · 51 weeks and 3 days ago
I’m impressed, I must say. Genuinely rarely must i encounter a weblog that’s both educative and entertaining, and let me tell you, you’ve hit the nail around the head. Your notion is outstanding; ab muscles something that insufficient consumers are speaking intelligently about. We are happy that we came across this in my look for something with this. http://instagramkommentarekaufen.simplesite.com/">Instagram Kommentare Kaufen
wenilak444 · 8 weeks ago
I’m impressed, I must say. Genuinely rarely must i encounter a weblog that’s both educative and entertaining, and let me tell you, you’ve hit the nail around the head. Your notion is outstanding; ab muscles something that insufficient consumers are speaking intelligently about. We are happy that we came across this in my look for something with this. [url=http://instagramkommentarekaufen.simplesite.com/]Instagram Kommentare Kaufen[/url]
wenilak444 · 8 weeks ago
The Arden is proudly developed by Qingjian Realty. Incorporated in Singapore since 2008, the firm have achieved many awards and concluded a wide array of ... The Arden Showflat
KayGasaway · 7 weeks and 6 days ago
We are a group of volunteers and opening a new system in our community. Your web site given us with valuable information to work on. You’ve done an impressive job and our entire community will be grateful to you. ONLINE VISA INDIA
wenilak444 · 7 weeks and 5 days ago
Amsoil Diesel Oil Beyond Performances is an Amsoil Dealer that provides the best Amsoil diesel oil, amsoil motor oil, best transmission fluid, and engine lubricants. https://beyondperformances.com/
wenilak444 · 7 weeks and 4 days ago
Can I say what relief to get somebody who in fact knows what theyre dealing with online. You certainly know how to bring a challenge to light and produce it critical. More people need to see this and fully grasp this side with the story. I cant think youre not more well-known because you undoubtedly develop the gift. ETA Canada
wenilak444 · 7 weeks ago
There are many books in a study room, no matter what the front page and ancient books are, they are all my favorite books. Panana Furniture Online UK 457339236 Actually, there is often a big deviation from our imagination.
wenilak444 · 6 weeks and 6 days ago
Find the best Christmas gift ideas and secret Santa gifts that will make the holidays merry and bright. Shop for christmas gifts ?in Singapore today. Christmas Gift Ideas – Explore Innerfyre website & make your loved once day special.
KayGasaway · 6 weeks and 4 days ago
Aw, this became an incredibly nice post. In notion I would like to put in writing such as this additionally – spending time and actual effort to produce a excellent article… but what things can I say… I procrastinate alot and also no indicates appear to go completed. USA INGRETSVISUM
wenilak444 · 6 weeks and 2 days ago
Shop High End Collection of cheap rings for women, Allegra N Co Offering Premium Collection of wedding Rings at Cheapest Affordable Prices, Free Shipping Across the US. We exist to provide you the highest quality engagement and wedding rings at affordable prices. Our rings are handcrafted from start to finish, without breaking the bank. Because we believe that a wedding does not have to cost you a fortune
KayGasaway · 6 weeks and 1 day ago
If You are looking to find Best helmet lock in india, This article is for you. Best Helmet Locks in India | Helmet Lock price | Helmet lock types. Helmets provide safety to your head And helmet lock makes your helmets safe In this so much busy life, helmets have become a necessity. Get True Reviews for the Online Products by Inidan review website.
KayGasaway · 6 weeks and 1 day ago
Java burn ingredients according to john barban javaburn ?ingredients are green tea extract green tea has long been known to have beneficial effects on the body due to the polyphenols and caffeine content it can help you lose weight it also has a very potent antioxidant that protects your body from weight gain john barban weight loss
KayGasaway · 6 weeks and 1 day ago
Explore the best black magic removal service in new york & get instantly Reomve Black Magic. A Black Magic Removal Expert, helping people worldwide to Remove Black Magic - Black Magic Curse Removal & Black Magic Spells Removal Programs at Affordable Prices - You will get Free emergency (First Aid) Magic Cleaning Video on the webiste. black magic removal service
KayGasaway · 6 weeks ago
The best eyesight max supplement reviews ?known as a popular for vision loss and eye care. It's been engineered and preparade by dR. EDWARD knodrot, who has been working in this field for many years, with the goal of improving eyesight and vision health
KayGasaway · 6 weeks ago
Explore permit expediting chicago ?| building permit chicago & Code Compliances Services, The Best Chicago Permit Expediter & chicago building permits, Permit studio offer chicago permit services, IL, As best chicago permit expediter, our team consists of a variety of talented and passionate professionals with backgrounds in architecture, interior design, planning, construction, and project management. Please visit our website for more info, Thank You
KayGasaway · 5 weeks and 6 days ago
???????????,??????,????????? ???????????????????????????????????????????????????????????????https www hatuasolutions com ? ???
KayGasaway · 5 weeks ago
????????? ?????? ???????https www stepspokane com ???????????????????????????????????????????????????????????????????? ?????
KayGasaway · 5 weeks ago
Explore Dormis Headphones #l wireless headband headphones for Sleep, Dormi Headphones are the best best headband headphones, most comfortable wireless headband headphones with a mic for running, yoga and sports Listen to music, audiobooks and ASMR in our bed friendly headphones Shop noise reducing earphones for sleep at our website. Visit website and get 10% OFF your order! best headband headphones
wenilak444 · 5 weeks ago
Discover the ideal vape kit for you from our selection of vapes. Here you will be able to choose from a variety of styles ranging from vape starter kits to more advanced devices. We chose to include vape kits that featured compact designs, easy-to-use functions, and pocket-friendly characteristics so you could get the best vaping experience. You will also find E-cigarette models supplied from leading brands such as Smok, Aspire, and Vaporesso.
wenilak444 · 4 weeks and 6 days ago
Accelerator Management Software and Incubators Startup Hubs. Create a group account for Business Incubators, Accelerators, Small Business Hubs or investors to be able to sponsor a group of companies to utilise the software, to ensure that they are employing best practices in governance and accountability. Please visit our website & Start with a 14-day FREE trial - no credit card needed. Thank You.
wenilak444 · 4 weeks and 5 days ago
Inbound takeaway courier promotion?Various special party set menus for free choice. Hong Kong people’s first choice for gourmet food at the meeting ?? catering service company?Kama Delivery Catering, Visit this website & get Multi-person attendance package, Optional lunch box for one person, Free shipping and free exchange and return polices as well as Free snacks at FPs Checkout. Don't miss this chance. ??
wenilak444 · 4 weeks and 5 days ago
I was recommended this website through my cousin. I am now not positive whether this put up is written via him as nobody else understand such detailed ????????? ??????? ????
nakav51247 · 4 weeks and 4 days ago
Excellent post, thank you a lot for sharing. Do you have an RSS feed I can subscribe to? www.MM88IT.com
wenilak444 · 4 weeks and 2 days ago
I am typically to blogging and that i actually appreciate your content regularly. The article has truly peaks my interest. I am going to bookmark your site and maintain checking achievable data. http://www.Hubhengjing888.com.com
wenilak444 · 4 weeks ago
Hi, Can I download your own image and make use of that on my weblog? https://www.ULTRACLUBASIA.com
wenilak444 · 3 weeks and 6 days ago
Hi there, May I grab your image and implement it on my web log? https://www.ULTRACLUBASIA.com
wenilak444 · 3 weeks and 6 days ago
Urban Landscape in Newport Beach, CA is Southern California's premier landscape design and construction provider. Over 30 years of professional, ... landscape maintenance Singapore
wenilak444 · 3 weeks and 5 days ago
I’ll immediately clutch your rss feed as I can not find your email subscription hyperlink or e-newsletter service. Do you have any? Kindly allow me realize in order that I may subscribe. Thanks. ?????? ???? ?? ??????
wenilak444 · 3 weeks ago
it is wise to choice to select Light Emitting Diode christmas lights becaue they are not fire hazard’ ????????joker123
wenilak444 · 3 weeks ago
Oh my goodness! a fantastic article dude. Thanks a ton However My business is experiencing trouble with ur rss . Don’t know why Struggle to subscribe to it. Will there be everyone obtaining identical rss problem? Anybody who knows kindly respond. Thnkx ????????????
wenilak444 · 2 weeks and 1 day ago
Global Marketplace for AI Services & Pool of Decentralized Computing Resources, WitLink is a global AI marketplace for AI services and pool of decentralized computing resources - Custom-built AI Solutions. AI Services and Machine Learning Training Programs. AI Services at WetLink.ai | Blockchain-Powered AI Marketplace. ai services
KayGasaway · 1 week and 1 day ago
??????????? ????????https www pikefootball com????????98 9 ???????????????????? ????????????????????????????? ????? ????????? ????? ????? ?????
KayGasaway · 1 week ago
Discover nokia mobile repair ?in UAE. Authorized Nokia Mobile Repair Center | 20+ Year of Trust Get the best Nokia mobile repair service in your doorstep or our axiom care Book your Nokia mobile repair now at affordable price at Axiom care.
nakav51247 · 5 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: