pipe to file named with date

I would like to pipe (redirect ? - what is the right term?) the output of my script to a file named with the current date.

If I run this at a command prompt:
date +'%Y%m%d"
...it returns "20110429"

OK, that's good... so I try:
./script.sh > "'date +%Y%m%d'.csv"

I get a file named: 'date +%Y%m%d'.txt
...I would like the file to be named: 20110429.csv

Actually, I would like it to be named: log20110429.csv

Am I in left field, or not even in the ballpark?

Thanks,
-dog

You'll have to use backticks:

./script.sh > `date +"%Y%m%d"`
1 Like