Auto-commit of .log by diary script
If search string is a valid path, open in editor

This required restructuring the program into functions. This was done naively
and there may some improvements to be had in the functions themselves.
Don't open matching files automatically

Because then you can't search for a string that matches a file name
Change all instances of program name "n" to $0

This way you can easily change the name of the program without having to edit
all the help text. Because "n" might collide with another program on your
system.
Clean up redundant code

Use option flags to eliminate the need for checking and rechecking positions of
parameters. We needed to check the positions because we don't want to have to
put options before arguments.
Shorten main execution logic
Simplify logic for search match opener, and alphabetize
Rename notes_path variable to notes
Number results of search_notes()
Use ! instead of / as sed delimiter
Remove matched file prompt from search_notes. Annoying
Use nl and sort instead of sed command to reverse line order
Auto-commit of .log by diary script
Auto-commit of .log by diary script
Auto-commit of .log by diary script
print errors to stderr and set exit status