diff --git a/README.md b/README.md index 824746f..5332f25 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Spaces in filename seem to make trouble at the moment - avoid them. `balance.sh` just gives your account balance. -`faxreport.sh [options] [id]` loads the report of a given fax id (as shown by status.sh) +`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. : Options are not implemented yet, but those are gonna be accepted: * `-p` to only print and not save the report * `-d` to delete the given id from `.fax_history` diff --git a/faxreport.sh b/faxreport.sh index 6b9edc6..04940cb 100755 --- a/faxreport.sh +++ b/faxreport.sh @@ -27,7 +27,13 @@ done if [ $IDF = false ] then echo "Guessing…" - exit 0 # Nur, damit es nix durcheinanderbringt, bis die guess-Arithmetik implementiert ist + $ID=$(tail -n 1 $BASEPATH/.fax_history) + if [ -z $ID ] + then + echo "Nothing to guess from. Please send a fax first" + exit 1 + fi + $IDF=true fi . $BASEPATH/authorization.sh # stellt AUTH_TOKEN bereit @@ -36,7 +42,7 @@ JSON=$(curl -X GET -H "accept: application/json" -H "Authorization: Bearer $AUT DATE=$(echo $JSON | jq '.created' | sed -e 's:"::g' ) if [ -z $DATE ] then - echo "Fax seems to not exist. " + echo "Fax seems to not exist with this account." exit 1 fi DATE=$(date -d $DATE +%Y%m%d%H%M)