scripts/day

28 lines
591 B
Plaintext
Raw Normal View History

2024-12-25 21:14:35 +01:00
#!/bin/sh
2025-01-02 11:18:27 +01:00
# Based on day script from mischavandenburg
2024-12-25 21:14:35 +01:00
# url: https://github.com/mischavandenburg/dotfiles/blob/main/scripts/day
today=$(date +"%Y-%m-%d")
tomorrow=$(date -d "tomorrow" '+%Y-%m-%d')
yesterday=$(date -d "yesterday" '+%Y-%m-%d')
file="$SECOND_BRAIN"'/periodic/daily/'"$today.md"
cd "$SECOND_BRAIN" || exit 1
new_note() {
2025-01-02 11:18:27 +01:00
cp "$SECOND_BRAIN/templates/daily.md" "$file"
2024-12-25 21:14:35 +01:00
2025-01-02 11:18:27 +01:00
sed -i "s/TODAY/$today/" "$file"
2024-12-25 21:14:35 +01:00
2025-01-02 11:18:27 +01:00
sed -i "s/YESTERDAY/$yesterday/" "$file"
2024-12-25 21:14:35 +01:00
2025-01-02 11:18:27 +01:00
sed -i "s/TOMORROW/$tomorrow/" "$file"
2024-12-25 21:14:35 +01:00
}
if [ ! -f "$file" ]; then
new_note
fi
nvim '+ normal Gzzo' "$file"