PDA

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



dilerra
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

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

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

mkdir `date +%F`

does the job.

Best,
Bart

rsay
September 26th, 2005, 08:57 PM
Try

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.

dilerra
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

Thanks!

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.