diff options
author | EuAndreh <eu@euandre.org> | 2025-03-31 21:51:40 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2025-03-31 21:51:40 -0300 |
commit | 570ec471d1605318aeefb030cd78682ae442235b (patch) | |
tree | 51e17eabe37c6689f8799b55e6875c3480329a2c /src/content/tils/2020/08/12 | |
parent | Makefile, mkdeps.sh: Derive index.html and feed.xml from more static "sortdat... (diff) | |
download | euandre.org-570ec471d1605318aeefb030cd78682ae442235b.tar.gz euandre.org-570ec471d1605318aeefb030cd78682ae442235b.tar.xz |
src/content/: Update all files left to asciidoc
Diffstat (limited to 'src/content/tils/2020/08/12')
-rw-r--r-- | src/content/tils/2020/08/12/filename-timestamp.adoc | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/src/content/tils/2020/08/12/filename-timestamp.adoc b/src/content/tils/2020/08/12/filename-timestamp.adoc index 7495fc9..ed7dee8 100644 --- a/src/content/tils/2020/08/12/filename-timestamp.adoc +++ b/src/content/tils/2020/08/12/filename-timestamp.adoc @@ -1,44 +1,30 @@ ---- - -title: Simple filename timestamp - -date: 2020-08-12 - -updated_at: - -layout: post - -lang: en - -ref: simple-filename-timestamp - -eu_categories: shell - ---- += 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 +struggle with finding a direct way of accomplishing that. There's a simple solution: `date -I`. -```shell +[source,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. +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 +[source,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. +left. This means that you can easily sort them (and even tab-complete them) +with no extra effort or tool required. |