Repetition is boring, and tedious. Chances are there are many parts of our life can be automated. This time I just want to share a very simple script that I use to print out current date, which I occasionally use, in different situations.
To save time on trying to remembering (or needing to ask for) current date, I normally issue this command:
shakir@herugrim ~ $ date Thu Jul 26 16:12:05 GMT 2007 shakir@herugrim ~ $ date +%F 2007-07-26 shakir@herugrim ~ $ date +%F | tr -d "-" 20070726
The next step is to create a bash script named xxdate, as based on my previous post, which looks something like this:
#!/bin/bash
date +%F | tr -d "-"
Let’s try it out..
shakir@herugrim ~ $ mkdir -p Pics/`xxdate`" - Honeymoon… I wish" shakir@herugrim ~ $ ls -lh Pics/ | grep Honeymoon drwxr-xr-x 2 shakir shakir 48 Jul 26 16:20 20070726 - Honeymoon… I wish"
p/s: The date format is the school of thought that I use when I want to have a sortable folders / files, which turns to be very important when I started to be very dependent on my laptop (file counts increase steadily and really need proper management). Opinions might vary though.
p/s: This posting is not to promote the script (though it’s very useful to me by itself) but the thought, which is automation…









