#!/bin/bash mail_dir=$(realpath --relative-to=. "$(dirname "$0")/../mails") printf -v TARGET '%s/%(i%Y-%m-%d+%s)T.email' "$mail_dir" -1 subject="$1" to="$2" cc="$3" { cat < "$TARGET" gvim "$TARGET" printf 'When you are finished editing you need to send %s\n' "$TARGET" exit 0