Did you know LQ has a Linux Hardware Compatibility List?
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


LinkBack Search this Thread
Old 06-11-2004, 01:30 PM   #1
LQ Newbie
Registered: Aug 2003
Posts: 19

Rep: Reputation: 0
How to append today's date in a script

Hi all,

I am using a daily script which outputs a file. Test.html for example. How do I append a date to it so that the output will be TodaysDateTest.html for everyday.

Thanks very much
Old 06-11-2004, 01:34 PM   #2
Registered: Mar 2004
Location: bursa
Posts: 110

Rep: Reputation: 15
dosomething > `date +%F`_test.html
Old 06-11-2004, 01:40 PM   #3
LQ Newbie
Registered: Aug 2003
Posts: 19

Original Poster
Rep: Reputation: 0

Old 06-12-2004, 04:05 AM   #4
LQ Newbie
Registered: Jun 2004
Posts: 5

Rep: Reputation: 0
I tried that, and for some reason it didn't work?

Maybe I did it wrong.

I personally like this:

ghost@sshd:~$ time=$(date | cut -b 5-10)
ghost@sshd:~$ echo "test" > "$time"_Test.html
ghost@sshd:~$ ls | grep Test
Jun\ 12_Test.html

Last edited by mparkhurs; 06-12-2004 at 04:18 AM.
Old 06-12-2004, 08:37 AM   #5
Registered: Mar 2004
Location: bursa
Posts: 110

Rep: Reputation: 15
mparkhurs, did you type it exactly as I had? If so, what was the output?

Spaces in filenames are generally Not a Good Thing, imo. Also, you've left the year off.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Append the windows path with Samba login script ?? amitsharma_26 Linux - Networking 2 09-29-2005 10:46 AM
How to append hostname in a script anjaan Programming 5 06-14-2004 10:41 AM
help with Date command in script icw_sec Programming 6 01-06-2004 11:02 AM
Date in a BASH script... soulsniper Linux - Software 7 11-22-2003 06:08 PM
can't retrieve the date in my script wedgeworth Linux - Software 0 09-15-2003 11:41 AM

All times are GMT -5. The time now is 03:28 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration