r/ScriptSwap • • Mar 02 '12

datestamp

Script to print a datestamp (the current date time in the format 201203012109)

Typical use:

mv somefile somefile.bak.`datestamp`

Script

#!/bin/sh
date +'%G%m%d%H%M'
5 Upvotes

5 comments sorted by

View all comments

Show parent comment

1

u/memorylane Mar 02 '12

Thanks for the tip. I'll use $() in my scripts from now on, but on the terminal as a one liner it's just so much easier to hit ` than hit shift 4 shift 9 ... shift 0.