X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=send_email;h=b2b1b54cb92927973c1d01bc67fbb1cd2f9a7ea4;hb=1fab4a50f4e2f6726480571e75c1b936792ec7da;hp=a8e60a2492d858c09f40cb1fa2d5503190bed146;hpb=6fcb1ac2ddc2ae590651475474488932d868c360;p=next-scripts diff --git a/send_email b/send_email index a8e60a2..b2b1b54 100755 --- a/send_email +++ b/send_email @@ -1,26 +1,33 @@ #!/bin/bash -TARGET=$HOME/work/topics/linux-next/mails/$(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