How to get seconds-since-epoch in shell script

Randal Schwartz merlyn at iwarp.intel.com
Fri Sep 28 03:25:41 AEST 1990


In article <MJD.90Sep27110855 at central.cis.upenn.edu>, mjd at central (Mark-Jason Dominus) writes:
| I want to be able to get the the time in seconds-since-epoch
| form, and I was surprised to learn that none of the `date'
| commands we have near here had a seconds-since-epoch format,
| since it would have been so easy to include.
| 
| Is there a way to get that time that is easier than
| computing it from the second, minute, hour, julian-date, and
| year?

perl -e 'print time;'

Looks pretty easy to me.  If you were willing to fork a 'date',
forking a 'perl' is about as tough.

[What, you're not running Perl yet?  Complain to your sysadm...]

print "Just another Perl hacker,"
-- 
/=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\
| on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III      |
| merlyn at iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn |
\=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/



More information about the Comp.unix.questions mailing list