How can I create a folder named like the current date in bash So I'm messing around in my .bashrc making different aliases and playing with my prompt. I'm trying now to make an alias that will move into a specific directory, make a new directory based on the date, and make a new file. All in one alias. Here's what I've done...

export DATE="$( date +%d-%b )"
alias hw='cd ~/Java/Homework/257; mkdir $DATE; cd $DATE; vim'


Now if I go out and run hw Client.java it should move into ~/Java/Homework/257/27-Jan/ and open a new file called Client.java in vim. It all works beautifully except the date variable doesn't work right. It moves me into the ~/Java/Homework/257 directory and makes two directories. One called date and another called +%d-%b and puts the Client.java file in the date directory.

I thought my date variable export simply wasn't working but when I type $DATE at the command prompt it gives me 27-Jan like it should. So does anyone know what could actually be causing this? A friend of mine did something very simliar to this using a slightly different format string for the date and his works just fine. The only thing I have different on my computer is bash-completion from homebrew but I don't see how that would effect my date...
export DATE="$( date +%d-%b )"


You need to actually execute it. Otherwise you just assign a string value. Since you're missing quotes around the $DATE, it will be interpreted as two separate arguments, date and +%d-%b.