datedir as executable

This commit is contained in:
q
2024-09-27 09:29:57 +03:00
parent 2193eeebd6
commit 846919be23
2 changed files with 15 additions and 0 deletions

1
bin/mkdatedir Symbolic link
View File

@@ -0,0 +1 @@
../files/mkdatedir

14
files/mkdatedir Executable file
View File

@@ -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/