The power of bash

I need to write a journal by week, so I’d like to create a file
name like

"week<current week of year>.<year>.<the first date of
this week> – <the last date of this week>, then alias to "j". Googled a little bit, and figure it out, sweet!!

1. Current week: date +%U

2. the first date of this week: date -d "-$(date +%w) days" +%m.%d

3. the last date of this week: date -d "$((6-$(date +%w))) days"
+%m.%d

4. whole command will be:

alias j="vi week`date +%U`.`date -d "-$(date +%w) days" +%Y.%m.%d`-`date -d "$((6-$(date +%w))) days" +%m.%d`" 

" ` " is the symbol under "~", not quote though.

Advertisements