#!/bin/bash # $HeadURL$ $LastChangedRevision$ # Modules . $(miniade) || { echo "${0##*/}: ERROR: miniade failed (hint: run 'miniade' to see error)" >&2; exit 1; } # Configurable stuff # Other globals main() { local MY_ARGS # Defaults for options # Process options miniade_process_options --help-handler=help MY_ARGS "$@" && set -- "${MY_ARGS[@]}" # Process arguments [ $# = 1 ] || miniade_bad_usage type encode > /dev/null 2>&1 || miniade_internal "encode: command not found (hint: is PATH set correctly?)" ENCODE_OUTPUT=$(encode --decode "$1") || miniade_internal "encode: failed (hint: see messages above)" eval set -- "$ENCODE_OUTPUT" [ $# -eq 3 ] || miniade_bad_usage RCPT="$1" SUBJECT="$2" BODY="$3" # Sanity checks and derivations mailx -s "pcms: $(uname -n): $SUBJECT" -r pcms@$(uname -n) $RCPT <<<"$BODY" } help() { local PROGNAME miniade_get_progname PROGNAME echo "Usage: $PROGNAME [ ] @@" exit 0 } main "$@"