From 42e27220a6a786522addbd34db715325a0d01344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20R=C3=BCmpelein?= Date: Fri, 2 Jan 2015 12:51:52 +0100 Subject: [PATCH] Added sender-option. --- src/pizza | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/pizza b/src/pizza index d78281d..d7ff8f3 100755 --- a/src/pizza +++ b/src/pizza @@ -5,13 +5,15 @@ PIZZAHOST=$(hostname -f) PIZZAUSER=$(whoami) PIZZAART= PIZZARCV= +PIZZASEND= help() { echo "pizza - sent small ASCII-Icons by Mail" echo "--------------------------------------" echo "Usage: -p Sent a pizza (default)" echo " -l Sent a heart" - echo " -m Receivers address non-optional)" + echo " -m Receivers address (non-optional)" + echo " -s Senders address, defaults to user@host" echo " -h Print this help-message" } @@ -21,7 +23,7 @@ if [ ! $1 ]; then exit 1 fi -while getopts "plhm:" opt; do +while getopts "plhm:s:" opt; do case ${opt} in p ) : ${PIZZAART:="pizza"} @@ -32,6 +34,9 @@ while getopts "plhm:" opt; do m ) PIZZARCV="${OPTARG}" ;; + s ) + PIZZASEND="${OPTARG}" + ;; h ) help exit 0 @@ -44,6 +49,7 @@ while getopts "plhm:" opt; do done : ${PIZZAART:="pizza"} +: ${PIZZASEND:="${PIZZAUSER}@${PIZZAHOST}"} if [ ! $PIZZARCV ]; then echo "Argument '-m' and mailaddress needed!" @@ -51,5 +57,5 @@ if [ ! $PIZZARCV ]; then exit 1 fi -mail -s "${PIZZAUSER} sent you a ${PIZZAART} on ${PIZZAHOST}!" ${PIZZARCV} < "${PIZZAINC}/${PIZZAART}" +mail -s "${PIZZAUSER} sent you a ${PIZZAART} on ${PIZZAHOST}!" -S from=${PIZZASEND} ${PIZZARCV} < "${PIZZAINC}/${PIZZAART}" exit 0