• Mac OS X,  Mac OS X Server,  Mass Deployment,  Ubuntu,  Unix,  VMware

    Using Dates in Shell Scripts

    At a terminal prompt, it is really straight forward to grab the date, simply use the date command, with no arguments and you will get something similar to the following, including the day, date, time (with seconds), time zone and year: Tue Apr 15 00:40:07 CDT 2009 In a script this can choose fairly challenging, especially in cases where you just need the date stamp without the time and time zone, etc. Here we’re going to grab the current system date from ESX, OS X or Linux (or whatever OSen really) and then use a variable, currentdate, to put that date, formatted into a pretty standard format, YYYYMMDD: currentdate=`date ”+%c%m%d”…