digitec: improve script

This commit is contained in:
Nico Schottelius 2022-08-19 12:49:28 +02:00
parent 35aa56cfdb
commit f07681b0f7
1 changed files with 25 additions and 8 deletions

33
digitec-cable.sh Normal file → Executable file
View File

@ -1,22 +1,39 @@
#!/bin/sh
if [ $# -lt 2 ]; then
echo $0 ordernum num-cables [otherinfo]
if [ $# -lt 1 ]; then
echo $0 ordernum [num-cables] [otherinfo]
exit 1
fi
ordernum=$1; shift
numcables=$1; shift
if [ $# -ge 1 ]; then
numcables=$1; shift
else
numcables=1
fi
other="$@"
date=$(date -R)
f=nico.schottelius
f2=ungleich.ch
fall=${f}@${f2}
cat <<EOF |
To: d2b@digitec.ch
From: Nico Schottelius <${f}@$f2}>
Subject: Falsches Stromkabel Bestellung
Hello World
cat <<EOF | /usr/sbin/sendmail ${fall}
From: Nico Schottelius <${fall}>
To: digitec <d2b@digitec.ch>
Subject: Falsches Stromkabel Bestellung ${ordernum}
Date: ${date}
Hallo Digitec,
die Bestellung ${ordernum} kam mit einem Schuko-Anschlusskabel anstatt
Schweizer Stecker. Bitte ${numcables} Adapter nachliefern.
Gruss,
Nico Schottelius
EOF