Re: How to create a formatted timestamp and use it in filename in a script?

From: Barry Margolin (barmar_at_alum.mit.edu)
Date: 01/29/05


Date: Fri, 28 Jan 2005 21:47:20 -0500

In article <cteiro$an4$03$1@news.t-online.com>,
 ulf2m@email.com (Ulf Meinhardt) wrote:

> I want to
> 1.) get the current timestamp (including milliseconds !)
> 2.) format it according to usual options and finally
> 3.) create a filename from it
>
> All together it should be similar to:
>
> myts=getTimestamp(dd.MM.yyyy_HH:mm:ss:ms)
> myfilename=aaa_{$ts}.log
>
> How do I do this in unix shell script ?

man date

and notice the +<format> option.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


Relevant Pages