Insert date question

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: KevinO
Date:  
Subject: Insert date question
tickticker wrote:
> Good evening,
>
> I'm script-challenged, and am having a little issue here.
>
> I have a text file that I would like to update fairly regularly, let's call it
> Update. Every time I update it, I make a copy of it in the form of
> Update_<today's-date>
> so that I have a historical record of what shape the file was in every time I
> updated it.
>
> I was thinking of making a script to do this, but my scripting is lousy. I
> was using emacs (no flames please) to try something along the lines of:
>
> cp Update Update_<code-to-insert-date>
> emacs -nw Update
>
> to first make a dated copy, then open up the original for editing.
>


man date

example: $ cp Update Update_`date '+%b-%d-%Y-%T'`

The " '+%b-%d-%Y-%T' " is to set the format of the date. The forward slash "/"
is an illegal character for a filename, for instance.

- --
KevinO

A great writer named Neal Stephenson said that America does four things
better than any other country in the world: rock music, movies, software
and high-speed pizza delivery. All of these are sacred American art forms.
Let's return to our purity and our idealism while we have this shot.
- - Courtney Love