[svlug] Calcurse Mail Reminder

Scott DuBois rhcom.linux at gmail.com
Tue Jan 20 11:32:47 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.

Fixed that bug I found and also fixed another one while I was at it. Seems if
one sets a 'repeating' reminder the string changes yet again. I'm suspecting
that I will be editing this script once or twice more in the future as I use the
program more. Hopefully (maybe) find a way to reduce the script to something
smaller too. For now though, it's working.

Maybe a text message next?

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



alcurse 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
mssg=/home/roguehorse/.calcurse/apts

# file location to notes
notes=/home/roguehorse/.calcurse/notes

# file location to todo
todo=/home/roguehorse/.calcurse/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

  do

   appts=$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

        # check for the note hash identifier '>' in field 11 
        if [[ $(echo $today | cut --delimiter=' ' --fields=11) =~ '>'[^' '] ]]; then 

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

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

        else

         printf ""
           
        fi

        # check for the note hash identifier '>' in field 8
        if [[ $(echo $today | cut --delimiter=' ' --fields=8) =~ '>'[^' '] ]]; then 
        
         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"

        else

         printf ""

        fi

        # check for the note hash identifier '>' in field 3
        if [[ $(echo $today | cut --delimiter=' ' --fields=3) =~ '>'[^' '] ]]; then 
        
         uniqID=$(echo $today | cut --delimiter=' ' --fields=3 | tr -d '>')

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

        else

         printf ""

        fi
 

       fi 

     fi
  
  done < $mssg

 else

  printf "Nothing Today\n"

fi

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

 printf "Todo List...\n" 

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

  do

   list=$todoLine

    echo $list

  done < $todo

fi

# 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/23b8bf4e/attachment.bin


More information about the svlug mailing list