#!/bin/bash # export emacs planner mode daily files to apple ical plandir="${HOME}/Documents/plan" outputdir="${HOME}/Downloads" if [ $# -eq 0 ] then mfd=$(date +%Y.%m.%d) mfd1=$(date +%Y%m%d) else mfd=$(date -d $1 +%Y.%m.%d) mfd1=$(date -d $1 +%Y%m%d) fi if [ -e ${plandir}/${mfd}.muse ] then awk -f ep2ical.awk time=$mfd1 outputdir=$outputdir <(sed 's/\(.*\) (\[\[\(.*\)\]\])/\1 \2/;s/\(..\) \(.\) /\1 \2 /' ${plandir}/${mfd}.muse) echo "Done!" else echo "Can't find planner file ${mfd}.muse." >&2 exit 1 fi exit 0