From 846919be23a33c82f40aad4379605fbf139f4ff4 Mon Sep 17 00:00:00 2001 From: q Date: Fri, 27 Sep 2024 09:29:57 +0300 Subject: [PATCH] datedir as executable --- bin/mkdatedir | 1 + files/mkdatedir | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 120000 bin/mkdatedir create mode 100755 files/mkdatedir diff --git a/bin/mkdatedir b/bin/mkdatedir new file mode 120000 index 0000000..f254256 --- /dev/null +++ b/bin/mkdatedir @@ -0,0 +1 @@ +../files/mkdatedir \ No newline at end of file diff --git a/files/mkdatedir b/files/mkdatedir new file mode 100755 index 0000000..d7fdba0 --- /dev/null +++ b/files/mkdatedir @@ -0,0 +1,14 @@ +#!/bin/bash +set -e +if [[ "$1" = "--help" ]]; then + echo 'Creates a dir with "%Y-%m-%d-[argument], in the current folder."' + echo 'Without argument, just the date is used' + exit +fi +printf -v dirbase "%(%Y-%m-%d)T" -1; +if [[ -n "$1" ]]; then + dirbase="$dirbase"-"$1"; +fi; +mkdir "$dirbase"; +echo $dirbase/ +