View Full Version : Making a directory with the help of todays date

September 26th, 2005, 08:35 PM
Hi all,

I'm really frustrated. I'm new into piping, and I cannot seem to get some fairly simple stuff to get working. I want to create a folder with todays date.

To get the date i enter "date +%F". Now I'd like to redirect the output to the command "mkdir", kind of like "date +%F | mkdir"... but this doesn't work.

Any clues on how to get past this simple task? :)

/ M

September 26th, 2005, 08:48 PM
mkdir $(date +%F)

September 26th, 2005, 08:50 PM
I don't know how to use a pipe, but

mkdir `date +%F`

does the job.


September 26th, 2005, 08:57 PM

mkdir $(date +%m_%d_%y)

You should be able to start from this. You can use "man date" for more parameters if you need them.

September 27th, 2005, 06:58 AM
mkdir $(date +%F)

This was exactly was I was looking for. Now maybe I will get that backup script up and running in a few minutes :D


jerome bettis
September 27th, 2005, 10:25 AM
advanced bash scripting guide, pdf
http://www.tldp.org/LDP/abs/abs-guide.pdf (right click -> save as)

a few weeks ago i sucked at bash and thought it was messy. after reading a few chapters of that, i kind of like it.