On Tue, Sep 25, 2007 at 04:17:41PM -0700, Dennis Peterson wrote:
> >>> Epoch time:
> > 
> > Golfed:
> > 
> > perl -le print+time
> 
> It wouldn't be Perl if there were only one way to do it ;)

But it's not necessarily good to include all possible ways. I mean,
this works too:

    perl -ple '$_=$^T'<<<1

But that's not exactly self-documenting. Plus it's a bitch to embed in
a script because of all the quote characters, and finally, it uses a
bashism to provide a single line on stdin :) (if you don't use bash,
add "echo|" in front and remove the "<<<1").

I optimised for keystrokes, and less complicated characters that
possibly need quoting.

You could also optimize for the non-existance of perl, and use awk,
which might be even more uniformly available (eg, modern FreeBSD
comes without perl if you do a bare bones install. Then again,
FreeBSD date groks %s).

So, TIMTOTDI squared (look ma', no perl!). This does the same as
date +%s too:

    echo|awk '{print systime()}'

-- 
Jan-Pieter Cornet <[EMAIL PROTECTED]>
!! Disclamer: The addressee of this email is not the intended recipient. !!
!! This is only a test of the echelon and data retention systems. Please !!
!! archive this message indefinitely to allow verification of the logs.  !!
_______________________________________________
Help us build a comprehensive ClamAV guide: visit http://wiki.clamav.net
http://lurker.clamav.net/list/clamav-users.html

Reply via email to