File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#! /bin/bash
22
33# Calculate the next Tuesday (or today if it's Tuesday)
4- current_weekday=$( date +%w) # 0=Sun ... 6=Sat
5- days_to_tuesday=$(( (2 - current_weekday + 7 ) % 7 ))
4+ current_weekday=$( date +%w) # 0=Sun ... 6=Sat
5+ days_to_tuesday=$(( (2 - current_weekday + 7 ) % 7 ))
66
77# Add the calculated days (compatible with both macOS and Linux)
88if date -v +0d & > /dev/null; then
1313 tuesday=$( date -d " +${days_to_tuesday} days" +%Y-%m-%d)
1414fi
1515
16- year=${tuesday%% -* } # 2026
17- month=${tuesday#* -}
18- month=${month% -* } # 02
19- day=${tuesday##* -} # 24
16+ year=${tuesday%% -* } # 2026
17+ month=${tuesday#* -} ; month=${month% -* } # 02
18+ day=${tuesday##* -} # 24
2019
2120# Define paths
2221folder_path=" docs/posts/$year /$month /$day "
@@ -26,7 +25,7 @@ file_path="$folder_path/index.md"
2625mkdir -p " $folder_path "
2726
2827# YAML frontmatter
29- cat << EOF >"$file_path "
28+ cat << EOF > "$file_path "
3029---
3130title: "Your Blog Post Title"
3231date: $tuesday
@@ -54,4 +53,3 @@ echo ""
5453echo " Reminder: Use existing categories and tags when possible."
5554
5655python " ./docs/find_tags_categories.py"
57-
You can’t perform that action at this time.
0 commit comments