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? :D

About these ads

18 Responses to “jn, a journal notebook tool”


  1. 1 Molecula21 2010/12/28 at 11:14 AM

    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…

    • 2 Ben Winston 2010/12/28 at 11:56 AM

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

  2. 8 Ben Winston 2010/12/28 at 11:58 AM

    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!

    • 9 Mobilediesel 2010/12/28 at 3:17 PM

      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.

      • 10 Ben Winston 2010/12/28 at 4:28 PM

        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!

  3. 11 Parka 2010/12/29 at 12:54 AM

    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…

  4. 12 Parka 2010/12/29 at 12:56 AM

    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.

    • 13 Mobilediesel 2010/12/29 at 1:32 AM

      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.

  5. 14 Parka 2010/12/29 at 1:01 AM

    Sry for spamming your blog:D
    But somehow some stuff is missing above.
    Here is a pastebin link: http://archlinux.pastebin.com/H45sX3qp
    Greetings,
    Parka

  6. 15 evidex 2010/12/30 at 7:59 PM

    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 :)

  7. 16 Joey1978 2011/04/26 at 5:09 PM

    Don’t forget about bournal http://becauseinter.net/bournal/

    It has fancy encryption, used to be ccrypt, but now it’s gpg, so heavy duty for all those juicy details.


  1. 1 Links 28/12/2010: Putin for Russian Migration to GNU/Linux, Ex-Red Hat CEO is Suing Over Kickbacks | Techrights Trackback on 2010/12/29 at 2:05 AM
  2. 2 A built-in diary « Motho ke motho ka botho Trackback on 2011/04/12 at 7:58 AM

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




Welcome!



Visit the Wiki!

Some recent desktops


May 6, 2011
Musca 0.9.24 on Crux Linux
150Mhz Pentium 96Mb 8Gb CF
 


May 14, 2011
IceWM 1.2.37 and Arch Linux
L2300 core duo 3Gb 320Gb

Some recent games


Apr. 21, 2011
Oolite on Xubuntu 11.04
L2300 core duo 3Gb 320Gb

Enter your email address to subscribe to this blog and receive notifications of new posts.

Join 405 other followers

License

This work is licensed under the GNU Free Documentation License. Please see the About page for details.

Blog Stats

  • 3,963,486 hits

Archives


Follow

Get every new post delivered to your Inbox.

Join 405 other followers

%d bloggers like this: