views:

791

answers:

3

I tried using $(date) in my bash shell script, however I want the date in YYYY-MM-DD format. How do I get this?

A: 

You can do something like this:

$ date +'%Y-%m-%d'

+7  A: 

Try:

DATE=`date +%Y-%m-%d`
Philip Fourie
+1  A: 

Try: $(date +%F)

kwatford