Reputation: 107
This script uses gcalcli to check 2 gmail calendars and send me a consolidated email with the day's appointments
#!/bin/bash
# variables
[email protected]
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
events ()
{
for service in $(/bin/ls $dir/calendars/)
do
echo reminders for $service on $(date +%d-%m-%y)
echo -------------------------------------------------------
/usr/bin/gcalcli \
--config-folder $dir/calendars/$service \
agenda \
--tsv \
"`/bin/date -d 'now'`" \
"`/bin/date -d 'now + 24 hours'`" \
| /bin/grep -e 95 -e 96 -e 97 -e 99 \
| /usr/bin/awk '{$3=$4=""; print $0}'
done
}
echo $(events) | mail -s "reminders for $(date +%d-%m-%y)" $email1
My problem is that the results come in a single line, instead of one line per appointment. How can I fix this?
Upvotes: 0
Views: 30