#!/bin/bash # $HeadURL$ $LastChangedRevision$ set -e PROGNAME=$(basename $0) # Load support functions . $(pcms-config PCMS_SHARE_PREFIX)/scripts/support.sh main() { # Defaults for options VERBOSELEVEL=2 # Process options while [ $# -ge 1 ]; do case $1 in -d) VERBOSELEVEL=$2; shift ;; --debug=*) VERBOSELEVEL=${1#*=} ;; -v|--verbose) VERBOSELEVEL=3 ;; --) shift; break ;; -*) error "main: $1: bad option" ;; *) break ;; esac shift done # Process arguments [ $# = 1 ] || usage eval set -- $(encode --decode "$1") [ $# -eq 3 ] || usage RCPT="$1" SUBJECT="$2" BODY="$3" # Sanity checks and derivations mailx -s "pcms: $(uname -n): $SUBJECT" -r pcms@$(uname -n) $RCPT <<<"$BODY" } usage() { echo "Usage: $PROGNAME @@" >&2; exit 1; } main "$@"