From da68ac2ae2457196360df43fcc4943db672a193b Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 23 Oct 2020 06:40:12 -0300 Subject: assert-content.sh: Enforce filename to be title slug + date --- _tils/2020-08-12-simple-filname-timestamp.md | 33 ---------------------------- 1 file changed, 33 deletions(-) delete mode 100644 _tils/2020-08-12-simple-filname-timestamp.md (limited to '_tils/2020-08-12-simple-filname-timestamp.md') diff --git a/_tils/2020-08-12-simple-filname-timestamp.md b/_tils/2020-08-12-simple-filname-timestamp.md deleted file mode 100644 index a02c70b..0000000 --- a/_tils/2020-08-12-simple-filname-timestamp.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -title: Simple filename timestamp -date: 2020-08-12 -layout: post -lang: en -ref: simple-filename-timestamp ---- -When writing Jekyll posts or creating log files with dates on them, I usually -struggle with finding a direct way of accomplishing that. There's a simple -solution: `date -I`. - -```shell -./my-program.sh > my-program.$(date -I).log -cp post-template.md _posts/$(date -I)-post-slug.md -``` - -Using this built-in GNU/Linux tool allows you to `touch $(date -I).md` to readily -create a `2020-08-12.md` file. - -I always had to read `man date` or search the web over and over, and after doing -this repeatedly it became clear that both `date -I` and `date -Is` (`s` here -stands for seconds) are the thing that I'm looking for 95% of the time: - -```shell -# inside my-program.sh -echo "Program started at $(date -Is)" -# output is: -# Program started at 2020-08-12T09:04:58-03:00 -``` - -Both date formats are hierarchical, having the bigger time intervals to the -left. This means that you can easily sort them (and even tab-complete them) with -no extra effort or tool required. -- cgit v1.3