Include possibility to use Letterheads address sysem

This commit is contained in:
Gandalf 2021-03-14 13:56:28 +01:00
parent c6b4d48ae4
commit 4870aca1fd
2 changed files with 4 additions and 3 deletions

View file

@ -16,7 +16,7 @@ Spaces in filename seem to make trouble at the moment - avoid them.
`balance.sh` just gives your account balance. `balance.sh` just gives your account balance.
`faxreport.sh [options] [id]` loads the report of a given fax id (as shown by status.sh). If no `id` ist given, it takes the last sent fax from this machine. `faxreport.sh [options] [id]` loads the report of a given fax id (as shown by status.sh). If no `id` ist given, it takes the last fax sent from this machine.
Options: Options:
* `-p` to only print and not save the report * `-p` to only print and not save the report
@ -28,6 +28,7 @@ Put
alias fax="/your/path/to/this/project/fax.sh" alias fax="/your/path/to/this/project/fax.sh"
alias faxstatus="/your/path/to/this/project/status.sh" alias faxstatus="/your/path/to/this/project/status.sh"
alias faxbalance="/your/path/to/this/project/balance.sh" alias faxbalance="/your/path/to/this/project/balance.sh"
fax-from-handle () { fax $1 "$(/your/path/to/this/project/Letterhead/Adressen/address.sh -f $2)"; }
``` ```
into your `.bashrc` or `.bash_aliases` into your `.bashrc` or `.bash_aliases`

4
fax.sh
View file

@ -1,7 +1,7 @@
#! /bin/bash #! /bin/bash
#Check if I have enough parameters: #Check if I have enough parameters:
if [ -z $2 ] if [ -z "$2" ]
then then
echo "Usage: echo "Usage:
$ ./fax.sh <letter.pdf> <recipient> $ ./fax.sh <letter.pdf> <recipient>
@ -13,7 +13,7 @@ BASEPATH=$(dirname $(realpath $0))
#Prepare fax credentials: #Prepare fax credentials:
FILE=$1 FILE=$1
echo -n "Sending file ${FILE} " echo -n "Sending file ${FILE} "
REC=$(echo $2 | sed -e 's:[^+0-9]::g' -e 's:^0\([1-9]\):+49\1:') REC=$(echo "$2" | sed -e 's:[^+0-9]::g' -e 's:^0\([1-9]\):+49\1:')
echo "to $REC" echo "to $REC"
#Needs to be base64 encoded: #Needs to be base64 encoded:
CONTENT=$(base64 $FILE -w 0) CONTENT=$(base64 $FILE -w 0)