Friday, August 31, 2007

Getting the timestamp from the command line

it's

date +%s

I just saved you looking at a minimum of three man pages.

While we are on the topic, here's how to do simple timings. Yes I know about time but sometimes that's not quite what you want.

$ TIME_START=`date +%s`
$ #... stuff
# TIME_END=`date +%s`
# echo "It took `expr $TIME_END - $TIME_START` seconds."

enjoy

0 comments: