From 4c1885a138b88f2646350003d10051fc196e38dd Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Sat, 27 Nov 2021 07:19:11 -0800 Subject: [PATCH] mail wrapper script --- bin/mailto | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 bin/mailto diff --git a/bin/mailto b/bin/mailto new file mode 100755 index 0000000..3a830c6 --- /dev/null +++ b/bin/mailto @@ -0,0 +1,39 @@ +#!/bin/bash + +usage() { + echo "usage: ${0} [OPTION]" + echo + echo "Send email from standard input" + echo + echo " -s SUBJECT Subject line of the message" + echo " -t TO Email address of the recipient" + exit 1 +} + +if [ $# -lt 1 ]; then + usage +else + while [ $# -gt 0 ]; do + case "${1}" in + -s) + SUBJECT="${2}" + shift + shift;; + -t) + TO="${2}" + shift + shift;; + -h|--help) + usage;; + *) + echo "ERR - \"${1}\" is not valid" + usage;; + esac + done +fi + +body=$(