News for hackers. Stuff that matters.
Re:The more senior your job title, the more you need to keep... by blackrock on Thursday July 09, 2020 @04:39AM (#23778161)
Or, here's an even better alias.

  alias jim=' \
    journaldir="$HOME/journal" ;   \
    year="`date +%Y`" ;            \
    yearpath="$journaldir/$year" ; \
    [[ -d "$yearpath" ]] || mkdir -p $yearpath ; \
    jfile="log_`date -I`.md" ;                \
    jfilepath="$journaldir/$year/$jfile" ;    \
    header="# log_`date -I`\n\n# Highlights:\n\n" ; \
    [[ -f "$jfilepath" ]] && echo "Opening log: $jfilepath" || { echo "Creating new log: $jfilepath" ; echo -e "$header" >  $jfilepath ; } ; \
    vi $jfilepath ; '
Copy this to your .bash_aliases file. It's fully automatic. It'll create the directories automatically.

This will now create a /home/user/journal/YEAR/journalfile.md. It's now separated by year, so that you can run this forever, and have a maximum of 365 files per year directory.

This is a markdown file. And in the header variable, I had it fill in the new file with some basic headers. You can edit this yourself to add more.

Try it out, and let me know.

Re:The more senior your job title, the more you need to keep... by gtt on Monday July 13, 2020 @07:23AM (#23819524)
jim date: illegal option -- I

on macos

Re:The more senior your job title, the more you need to keep... by blackrock on Monday July 13, 2020 @08:15PM (#23827191)
It seems Bash on Mac doesn't work quite the same as Linux.

Try this instead. It works for me. Let me know.

Copy it to your ~/.bash_aliases. And source it.

  alias jim='
    function _jim() {
        journaldir="$HOME/journal"
        year=`date "+%Y"`
        today=`date "+%Y-%m-%d"`
        yearpath="$journaldir/$year"
        [[ -d "$yearpath" ]] || mkdir -p $yearpath         
        jfile="log_$today.md"
        jfilepath="$journaldir/$year/$jfile"
        header="# Log: $today\n\n# Highlights:\n\n" 
        [[ -f "$jfilepath" ]] && echo "Opening log: $jfilepath" || { echo "Creating new log: $jfilepath" ; echo -e "$header" >  $jfilepath ; } 
        vi "$jfilepath"
    }; _jim'