jn, a journal notebook tool

I have a relative “newcomer” application to share with you today. I mentioned a few times that I knew about a journal application that existed, but didn’t have permission to share it. I do now, so … here’s jn:

Ben Winston has come up with a very simple, very straightforward bash-driven tool that concatenates a journal file with an entry. No fancy gimmicks or wild-and-crazy triple-function Swiss-army knives.

Unix-ish is a good word for it. You can add to your journal with the editor of your choice, and you view your existing journal with less, the omnipresent pager application.

The “installer” — which really just adds a line or so to your .bashrc file for ease of startup — is adjustable on several points, so you can change the location and name of your journal, if you want.

And beyond that, it relies only on bash and your editor and the amount of space you have available on your drive. How you use the results, and how you arrange your diary are up to you.

Ben said he’s been looking for input on this, and if you have ideas or would like to help him improve it, his contact information is in the tarball.

And I know that in the midst of this holiday season, you have lots and lots of time on your hands. Don’t you? πŸ˜€

18 thoughts on “jn, a journal notebook tool

  1. Molecula21

    This application seams great! I’ve give it a try and encounter error executing “jn -u”:

    ___________________________________________________
    You will now be taken into , where you may compose your journal entry.

    Press enter to continue…
    /home/molecula21/.journal/jn: line 28: /tmp/1293502329: Permission denied
    thanks for the update!
    ___________________________________________________

    It seams that for some reason the application is not able to write to /tmp/. Is anyone getting the same problem? i dont wanna contact the author before being certain it is not some dummy error of mine…

    Reply
    1. Ben Winston

      did you try running “source .bashrc” beforehand? after a fresh install, it doesn’t quite map correctly until you run this command.

      Reply
      1. Molecula21

        I followed the instaructions on the README and sourced the bashrc. I reinstaled it (deleting ~/.journal, restoring ~/.bashrc and re-running jninstaller) and resourced the bashrc before executing any jn command but i still get the same behaviour. Maybe something messy with my bashrc? i can provide the file if needed.

        Really looking into using this application πŸ™‚

        Reply
          1. Don

            well, it ate my formating. πŸ™‚ There should be an editor listed after the `=’ up there. πŸ™‚

            Reply
  2. Ben Winston

    Thanks so much to K Mandla for publishing this wonderful blurb on my journal application πŸ™‚ I appreciate the praise very much, and welcome feedback with open arms!

    Reply
    1. Mobilediesel

      This looks like it will be useful. I only have minor feedback. This line:
      echo -e “$(date +%A) $(date +%B) $(date +%d), $(date +%Y) at $(date +%r):\n” >> $journal
      can be changed to:
      date ‘+%A %B %d, %Y at %r:’$’\n’ >> $journal

      and in the jninstaller, the section that sets the preferred editor can be set to use the $EDITOR variable, if set:
      #ask which editor to use when updating journal
      if [[ -z $EDITOR ]]; then
      echo -ne “Preferred Editor: ”
      read jneditor
      else
      jneditor=$EDITOR
      fi

      So if someone already has $EDITOR set, jninstaller will just use that and only ask for an editor if $EDITOR isn’t set.

      Reply
      1. Ben Winston

        Thanks so much for the feedback! As you could probably tell from the script, I’m a newcomer to bash πŸ™‚

        As for tying it in to the $EDITOR variable, I wasn’t sure if people would prefer updating a journal in something different than they normally edit config files with. Maybe having it default to $EDITOR and asking if they want that to be it or not? I don’t know, but it’s something to play around with.

        Again, thanks so much for the feedback!

        Reply
  3. Parka

    Is actually an external program needed for this?
    I have a simple bash function inside my .bashrc:


    nn() {
    local NOTE_FILE=$HOME/.notes
    #if file doesn’t exist, create it
    [[ -f “$NOTE_FILE” ]] || touch “$NOTE_FILE”

    #no arguments, edit file
    if [[ -z “$1” ]]; then
    vim “+set number” “$NOTE_FILE”
    elif (( $1 )); then tail -“$1” “$NOTE_FILE”
    elif [[ “$1” == “-s” ]]; then /bin/grep -E –color=always -i -C 1 “$2” “${NOTE_FILE}”
    elif [[ “$1” == “-h” || $1 == “–help” ]]; then
    printf “nn [options|note]: Make quick notes\n”
    printf “Options: \t\twrite to ‘${NOTE_FILE}’\n”
    printf “\t\t\tshow ‘${NOTE_FILE}’\n”
    printf “\t\tshow last lines of ‘${NOTE_FILE}’\n”
    printf “\t-s \tsearch ‘${NOTE_FILE}’ for \n”
    #append all arguments to file
    else
    echo “>> ‘$@'” >> “$NOTE_FILE”
    fi
    }

    It does basically the same…

    Reply
  4. Parka

    Is an external program needed for this?
    I have a simple bash function inside my .barhrc:

    nn() {
    local NOTE_FILE=$HOME/.notes
    #if file doesn’t exist, create it
    [[ -f “$NOTE_FILE” ]] || touch “$NOTE_FILE”

    #no arguments, edit file
    if [[ -z “$1” ]]; then
    vim “+set number” “$NOTE_FILE”
    elif (( $1 )); then tail -“$1” “$NOTE_FILE”
    elif [[ “$1” == “-s” ]]; then /bin/grep -E –color=always -i -C 1 “$2” “${NOTE_FILE}”
    elif [[ “$1” == “-h” || $1 == “–help” ]]; then
    printf “nn [options|note]: Make quick notes\n”
    printf “Options: \t\twrite to ‘${NOTE_FILE}’\n”
    printf “\t\t\tshow ‘${NOTE_FILE}’\n”
    printf “\t\tshow last lines of ‘${NOTE_FILE}’\n”
    printf “\t-s \tsearch ‘${NOTE_FILE}’ for \n”
    #append all arguments to file
    else
    echo “>> ‘$@'” >> “$NOTE_FILE”
    fi
    }

    It does basically the same.

    Reply
    1. Mobilediesel

      There’s probably as many ways to do this as there are people who want to type notes at the command line. I have something similar to what you posted in the pastebin and might use a combination of jn my note function.

      Reply
  5. Pingback: Links 28/12/2010: Putin for Russian Migration to GNU/Linux, Ex-Red Hat CEO is Suing Over Kickbacks | Techrights

  6. evidex

    This is a really nice little script (program?). Seeing as it write to a simple text file, you could easily make a cron job to have it copy to a web directory, and have an incredibly simple online blog.

    The only thing I could see to change is a slight typo in the text that comes up when you run it with an unknown arguement (jn -unknown). It reads,

    That’s not (currently) and option!
    Type jn -h for the help screen.

    When it should be

    That’s not (currently) an option!
    Type jn -h for the help screen.

    A minor nitpick. Well done Ben πŸ™‚

    Reply
  7. Pingback: A built-in diary « Motho ke motho ka botho

Leave a reply to Don Cancel reply