Created
October 13, 2022 08:21
-
-
Save cynthiahqy/722be78c3be8e78e979afba3bcc9b446 to your computer and use it in GitHub Desktop.
script for creating 12 month files for a given year with obsidian YAML
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
year=$1 | |
month_names=(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec) | |
month_num=(01 02 03 04 05 06 07 08 09 10 11 12) | |
mkdir $year | |
for (( idx = 1; idx < 12; idx++ )) ; do | |
file_name=$year/${month_num[idx]}-${month_names[idx]}.md | |
if [ ! -f $file_name ]; then | |
touch $file_name | |
echo "---\naliases: [\"${month_names[idx]} $year\", \"${year}-${month_num[idx]}\"]\n---" > $file_name | |
fi | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment