#!/bin/bash # /usr/local/bin/now # http://crystalfaeries.net/posix/bin/now # celeste:crystalfaery 2014-06-09 00:30:28+00:00 # we accept any argument to switch to sanitizing the output for file paths if [ $# == 0 ] then # default format: date -u --rfc-3339=seconds else # sanitize for use in a filename: date -u --rfc-3339=seconds | sed 's/:[0-9][0-9]+00:00// ; s/ /./g ; s/:/-/' fi