The Artima Developer Community
Sponsored Link

Java Buzz Forum
How Many Days Ago Was That?

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Weiqi Gao

Posts: 1808
Nickname: weiqigao
Registered: Jun, 2003

Weiqi Gao is a Java programmer.
How Many Days Ago Was That? Posted: Dec 11, 2004 10:25 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Weiqi Gao.
Original Post: How Many Days Ago Was That?
Feed Title: Weiqi Gao's Weblog
Feed URL: http://www.weiqigao.com/blog/rss.xml
Feed Description: Sharing My Experience...
Latest Java Buzz Posts
Latest Java Buzz Posts by Weiqi Gao
Latest Posts From Weiqi Gao's Weblog

Advertisement

After doing my "how many days ago" calculation in my head once too many, I set out to find a way to let my computer do the work. After trying Java and C, I settled on this bash script:

[weiqi@gao] $ cat ~/bin/daysago
#!/bin/bash
#
# Usage: daysago [date]
#
bc <<<`date +%j`-`date -d $1 +%j`

[weiqi@gao] $ daysago 11/23
18

Can you name all the bash features used in this script?

Read: How Many Days Ago Was That?

Topic: DDOS&#8217;ing the Spammers? Who cares? Previous Topic   Next Topic Topic: ClientJava.com Links(12) - AceMDI Framework, Trees without Nodes, ProgressMonitorInputStream

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use