Write system variables into file

Hi everyone,

I was told, i my job, to do a script that creates the backup of all the files that are important to us.
So i created the script, put it in the crontab and it works great.

Now what i want is to write to a file what directories have being copied with date and time.
How can i write to a file the present date and time?

This is the script i have:

echo "Backup OK in Dir /CTA: " date + "%d - %m - %Y at %T" > ./imp.txt

This should write to imp.txt file for example:
Backup OK in Dir /CTA: 28-10-2003 at 03:30:00

Can anyone help?

Thanx a lot

Jorge Ferreira

to echo the date of the files last modification, you could put the results of
'ls -lt filename

in a variable, then to get the date and time out alone youd have to do some type of awk or sed trickery (hehe sorry im not goodwith those).

to simply print the current date and time :
echo `date`

sorry for my lack of text manipulation knowledge! but dont worry someone else here will be able to tell you just how to do what you need.

You don't need to use echo...

date "+Backup OK in Dir /CTA: %d - %m - %Y at %T"

Thank you Gentlemen for your time:
Ygor and Norsk Hedensk

Thanx for the tip Ygor. It really works.

Jorge Ferreira