X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=send_email;h=b2b1b54cb92927973c1d01bc67fbb1cd2f9a7ea4;hb=HEAD;hp=1131d51a29d2d10cbb5b198b0e7f29e2d60a5de2;hpb=be6cbf87072c2163446c4ea791523559f2fbafd1;p=next-scripts diff --git a/send_email b/send_email index 1131d51..b2b1b54 100755 --- a/send_email +++ b/send_email @@ -1,26 +1,33 @@ #!/bin/bash -TARGET=$HOME/linux-next-$(date +"%Y-%m-%d+%s").email +mail_dir=$(realpath --relative-to=. "$(dirname "$0")/../mails") +printf -v TARGET '%s/%(%Y-%m-%d+%s)T.email' "$mail_dir" -1 +subject="$1" +shift to="$1" -cc="$2" -subject="$3" - -( - cat <*} + if grep -q -F "<$e>" <<<"$to"; then + unset "cc[$i]" + fi +done + +{ + printf 'To: %s\n' "$to" + if [ "${#cc[@]}" -gt 0 ]; then + printf 'Cc: %s\n' "${cc[@]}" + fi + printf 'Subject: %s\n\n' "$subject" cat -) > $TARGET +} > "$TARGET" -gvim $TARGET +gvim "$TARGET" -echo "When you're finished editing you need to send $TARGET" +printf 'When you are finished editing you need to send %s\n' "$TARGET" exit 0