tempdir=$(readlink -f "$tempdir")
trap "/bin/rm -f \"$tempdir\"/*.ics; rmdir \"$tempdir\"" QUIT INT EXIT
-for ics in "$@"; do
+for file in "$@"; do
bevents=($(grep -n BEGIN:VEVENT "$file" | cut -d: -f1))
eevents=($(grep -n END:VEVENT "$file" | cut -d: -f1))