#!/bin/bash FROM='' TO='' SUBJECT='' MSG='' AT='now' usage() { echo " Usage: $0 OPTIONS [-w \"10:45AM 03/14/2042\"] -f From Address -t To Address -s Subject -m Message -w When to send (optional) @see 'man at' " } while getopts ':f:t:s:m:w:h' flag; do case "${flag}" in f) FROM="${OPTARG}" ;; t) TO="${OPTARG}" ;; s) SUBJECT="${OPTARG}" ;; m) MSG="${OPTARG}" ;; w) AT="${OPTARG}" ;; h) usage; exit;; \?) echo -e "\nUnknown option: -$OPTARG" >&2;usage; exit 1;; :) echo -e "\nMissing argument for option -$OPTARG" >&2;usage; exit 1;; esac done if [ ! "$FROM" ] || [ ! "$TO" ] || [ ! "$SUBJECT" ] || [ ! "$MSG" ] then usage exit 1 fi echo "/usr/bin/mail -t <