notetools/md2imap/md2imap.sh

19 lines
394 B
Bash
Raw Normal View History

2024-04-10 15:17:04 +02:00
rm mbox
for f in input/*.md
do
f=${f##*/}
title=${f%.md}
uid=$(cat /proc/sys/kernel/random/uuid)
cp imap-note-header "$title".imap
sed -i "s/uid/${uid}/" "$title".imap
sed -i "s/title/${title}/" "$title".imap
sed -i "s/name/$1/" "$title".imap
sed -i "s/email/$2/" "$title".imap
cat "input/$f" >> "$title".imap
cat "$title".imap >> mbox
printf '\n\n' >> mbox
rm "$title".imap
done