#!/bin/sh # # Send mail with subject line. # - Cameron Simpson 23jun1998 # # point at sendmail; if not there hope $PATH finds it sendmail=/usr/sbin/sendmail [ -x "$sendmail" ] || sendmail=sendmail cmd=$0 usage="Usage: $cmd [-s subject] addresses..." subject= case $1 in -s) subject="Subject: $2"; shift; shift ;; esac [ $# = 0 ] && { echo "$usage" >&2; exit 2; } ( them=$1; shift while : do case $# in 0) break ;; esac them="$them, $1" shift done echo "To: $them" [ -n "$subject" ] && echo "$subject" echo exec cat ) | $sendmail -oi "$@"