[svlug] Calcurse Mail Reminder

Scott DuBois rhcom.linux at gmail.com
Tue Jan 20 08:23:21 PST 2015

On Tue, Jan 20, 2015 at 12:11:43AM -0700, Jesse Monroy wrote:
> Scott,
> I read through your script and I would make a few Stylistic changes.
> Again style, mostly for read ability.
> ON Line 33 you have:
>      if [ "$today" != '' ]; then
> I would change this to:
>      if [ X"$today" != X"" ]; then

Thanks for this tip. Yes, I've been bitten by the Python syntax complaints
before. It's annoying until one gets it drilled into their head.

I made the suggested changes as well as cleaned some other syntax up. I also
added the 'todo' list items at the end.

Unfortunately, I found a bug this morning. If one attaches a note to an 'all
day' item, the note identifier hash gets associated to field 3 instead of 8 and
throws an error. So I need to write a conditional that reads field 3 and
determines if there is a matching hash as well. I think I can use the '>' as a
marker as long as there is no empty space "" to the right of it.

# Script starts below this line -----------------

# Calcurse email reminders
# Verifies date association and
# includes any related notes
# Sun Jan 18 16:39:43 PST 2015
# Written by: Scott DuBois

# file location to appointments

# file location to notes

# file location to todo

# date results to variable
mdy=$(date +%m/%d/%Y)

# verify file exists
if [ -f $mssg ]; then

 # read each line from file separately
 while read -r line



    # check to see if dates match
    today=$(echo $appts | grep $mdy)

     if [ X"$today" != X"" ]; then 

      # print date relative messages
      echo $today
      printf "\n"

       #check to see if notes exist 
       if [[ "$today" =~ '>'[^' '] ]]; then

        # extract uniqe note ID
        uniqID=$(echo $today | cut --delimiter=' ' --fields=8 | tr -d '>')

          # retrieve notes by ID and append
          getNote=$(cat $notes/$uniqID)
          printf "Appt. Notes...\n"
          echo $getNote
          printf "\n"


  done < $mssg


  printf "Nothing Today\n"


# todo list
# verify file exists
if [ -f $todo ]; then

 printf "Todo List...\n" 

 # read each line from file separately
 while read -r todoLine



    echo $list

  done < $todo


# End of script

# Script ends above this line -----------------------

EFF ID: 1731778

"The difference between stupidity and genius is that genius has limits."
-- Einstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
Url : http://lists.svlug.org/archives/svlug/attachments/20150120/2ea04fb7/attachment-0001.bin

More information about the svlug mailing list