It works fine for me at the bash command line:
Code:
tred@vaio:~$ Date=`date +%F -d '-1 day'`
tred@vaio:~$ echo $Date
2009-01-20
tred@vaio:~$ mkdir ~/test/$Date
tred@vaio:~$ ls test
2009-01-20
tred@vaio:~$
If you are writing a script, what editor did you use to write the script on? If it was a windows editor, try writing it using a linux editor (and do NOT just copy&paste !).
Reason: linux and windows use different end-of-line markers.
Read up on
dos2unix and
unix2dos
Don't forget that most linux scripts should start with the line
so you know you'll be using the
bash shell to interpret the script..