]> git.ozlabs.org Git - next-scripts/commitdiff
send_email: tidy up
authorStephen Rothwell <sfr@canb.auug.org.au>
Wed, 30 Sep 2020 11:42:21 +0000 (21:42 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 30 Sep 2020 11:42:21 +0000 (21:42 +1000)
send_email

index 60842a7a991cdd472b88a933b0b91be785d90893..9930ad2b10e4742ced3431ee54fc467a38bf0af6 100755 (executable)
@@ -1,12 +1,13 @@
 #!/bin/bash
 
-TARGET="$(realpath --relative-to=. $(dirname $0)/../mails)"/$(date +"%Y-%m-%d+%s").email
+mail_dir=$(realpath --relative-to=. "$(dirname "$0")/../mails")
+printf -v TARGET '%s/%(i%Y-%m-%d+%s)T.email' "$mail_dir" -1
 
 to="$1"
 cc="$2"
 subject="$3"
 
-(
+{
        cat <<EOF
 To: $to
 Cc: $cc
@@ -14,10 +15,10 @@ Subject: $subject
 
 EOF
        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