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? π
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…
did you try running “source .bashrc” beforehand? after a fresh install, it doesn’t quite map correctly until you run this command.
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 π
I had to update the
JNEDITOR=
to be
export JNEDITOR=
Then things worked out well.
well, it ate my formating. π There should be an editor listed after the `=’ up there. π
Thanks for the patch Don, I’ve incorporated it.
Latest version: http://ompldr.org/vNnI2dQ/jn-0.3.1.tar
TY Don! Worked for me!
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!
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.
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!
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…
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.
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.
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
Pingback: Links 28/12/2010: Putin for Russian Migration to GNU/Linux, Ex-Red Hat CEO is Suing Over Kickbacks | Techrights
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 π
Pingback: A built-in diary « Motho ke motho ka botho
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.