Creating file with date/timestamp in it

I need to create a file through a c-shell script which contains only the date and time that the file was created. Does anyone know a simple way to do this?

Thank you,
Paula

If you were looking to place the date and time into an empty file then date '+%m%d%y %H%M%S' > /tmp/yournewfile will work in any shell.

Changing %m%d%y to %m/%d/%y gives 01/04/02 instead of 010402

Can anyone help me with creating a file from a shell script with the date in its name eg :

'log-2002-01-28.log'

Thanks in advance

Nic

To create a file named ... 'log-2002-01-28.log'

cat somefile > "log-`date '+%Y-%m-%d'`.log"

Cheers mate,

Ill have a play with that and see if i can get it to work:)

This will simply create a file.
#!/bin/sh
DATE="`date +%m``date +%d``date +%y`.log"
touch $DATE

boat73,
I tried pasting your code exactly, but it didn't work for me.
I tried more ways, with no luck.

Do u, or some1 else knows of a way it will work for me? I also prefer it in tcsh, if posible.

thanks.

This should do the trick.

#!/bin/csh
set filename="`date +%m%d%y`.out"
echo "$filename"