3 ms·
There is something I forgot to mention, but can't edit in now: running weekly notes. I'm not completely shooting from the hip. On login I get an editor with t
by bravetraveler 2y ago
There is something I forgot to mention, but can't edit in now: running weekly notes.
I'm not completely shooting from the hip.
On login I get an editor with two files/tabs:
1: this week
2: last week
This is the 'net' capturing anything not worthy of a calendar entry or ticket.
It's a relatively short BASH script with the week/year handled by 'date'. On mobile or I'd share it; will post with interest
- bravetraveler 2y agoI remembered y'all... 9 hours later, finally at a machine with a copy :) #!/bin/bash SCRIPT_NAME=$(basename "$0") if pgrep -f "$SHELL.*$SCRIPT_NAME" | grep -v $$ > /dev/null; then echo "The notes are already being edited elsewhere." exit 1 fi NOTE_DIR="${NOTE_DIR:-${HOME}/notes}" CURRENT_NOTE=$(date +%Y-week%V) LAST_WEEK_NAME=$(date -d '7 days ago' +%Y-week%V) NOTE_PATHS=("$NOTE_DIR/$CURRENT_NOTE" "$NOTE_DIR/$LAST_WEEK_NAME") EDITOR="${EDITOR:-vim}" if [[ $EDITOR == *vim* ]]; then # Run the vim-like editor with tabs $EDITOR -c ':tab all' "${NOTE_PATHS[@]}" else # Run the editor without vim tab arg; assume array is fine $EDITOR "${NOTE_PATHS[@]}" fi Triple dipping/posting thanks to that ~2 hour limit! Portability/efficiency wasn't really a concern in this - open to some golf