Closes #6
- Check whether include-file exists and is readable. - Added variable $PIZZAFILE
This commit is contained in:
parent
1b2de9a462
commit
48a66495f1
1 changed files with 15 additions and 1 deletions
16
src/pizza
16
src/pizza
|
@ -6,6 +6,7 @@ PIZZAUSER=$(whoami)
|
||||||
PIZZAART=
|
PIZZAART=
|
||||||
PIZZARCV=
|
PIZZARCV=
|
||||||
PIZZASEND=
|
PIZZASEND=
|
||||||
|
PIZZAFILE=
|
||||||
PIZZAVERSION="v1.0.1"
|
PIZZAVERSION="v1.0.1"
|
||||||
|
|
||||||
help() {
|
help() {
|
||||||
|
@ -64,6 +65,7 @@ done
|
||||||
|
|
||||||
: ${PIZZAART:="pizza"}
|
: ${PIZZAART:="pizza"}
|
||||||
: ${PIZZASEND:="${PIZZAUSER}@${PIZZAHOST}"}
|
: ${PIZZASEND:="${PIZZAUSER}@${PIZZAHOST}"}
|
||||||
|
PIZZAFILE="${PIZZAINC}/${PIZZAART}"
|
||||||
|
|
||||||
if [ ! $PIZZARCV ]; then
|
if [ ! $PIZZARCV ]; then
|
||||||
echo "Argument '-m' and mailaddress needed!"
|
echo "Argument '-m' and mailaddress needed!"
|
||||||
|
@ -71,5 +73,17 @@ if [ ! $PIZZARCV ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mail -s "${PIZZAUSER} sent you a ${PIZZAART} on ${PIZZAHOST}!" -S from=${PIZZASEND} ${PIZZARCV} < "${PIZZAINC}/${PIZZAART}"
|
if [ ! -f "${PIZZAFILE}" ]; then
|
||||||
|
echo "ASCII-art file ${PIZZAFILE} not found!"
|
||||||
|
echo "You may need to set \$PIZZAINC (the ASCII-art directory)."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -r "${PIZZAFILE}" ]; then
|
||||||
|
echo "ASCII-art file ${PIZZAFILE} not readable!"
|
||||||
|
echo "You may need to set the read rights correctly."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
mail -s "${PIZZAUSER} sent you a ${PIZZAART} on ${PIZZAHOST}!" -S from=${PIZZASEND} ${PIZZARCV} < "${PIZZAFILE}"
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in a new issue