From 4e04b2666706dc3c0a25f1b6ce705549cd23df83 Mon Sep 17 00:00:00 2001 From: Pedro Pombeiro Date: Sun, 22 Sep 2024 17:10:34 +0200 Subject: [PATCH] Run shellfmt on new scripts --- script/scantoemail-0.2.4-1.sh | 15 +++++++++------ script/scantoimage-0.2.4-1.sh | 12 ++++++------ script/scantoocr-0.2.4-1.sh | 10 +++++----- script/trigger_inotify.sh | 3 +-- script/trigger_telegram.sh | 2 +- 5 files changed, 22 insertions(+), 20 deletions(-) diff --git a/script/scantoemail-0.2.4-1.sh b/script/scantoemail-0.2.4-1.sh index c6f1a49..2090633 100755 --- a/script/scantoemail-0.2.4-1.sh +++ b/script/scantoemail-0.2.4-1.sh @@ -3,11 +3,14 @@ # $2 = friendly name { -echo "scantoemail.sh triggered" -#override environment, as brscan is screwing it up: -export $(grep -v '^#' /opt/brother/scanner/env.txt | xargs) + echo "scantoemail.sh triggered" + #override environment, as brscan is screwing it up: + export $(grep -v '^#' /opt/brother/scanner/env.txt | xargs) -SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" -/bin/bash $SCRIPTPATH/scanRear.sh $@ + SCRIPTPATH="$( + cd "$(dirname "$0")" || exit + pwd -P + )" + /bin/bash "$SCRIPTPATH"/scanRear.sh $@ -} >> /var/log/scanner.log 2>&1 +} >>/var/log/scanner.log 2>&1 diff --git a/script/scantoimage-0.2.4-1.sh b/script/scantoimage-0.2.4-1.sh index 465afe8..fc86ca2 100755 --- a/script/scantoimage-0.2.4-1.sh +++ b/script/scantoimage-0.2.4-1.sh @@ -4,9 +4,9 @@ { -echo "ERROR!" -echo "This function is not implemented." -echo "You may implement your own script and mount under $0." -echo "Check out scripts in same folder or https://github.com/PhilippMundhenk/BrotherScannerDocker for examples." - -} >> /var/log/scanner.log 2>&1 \ No newline at end of file + echo "ERROR!" + echo "This function is not implemented." + echo "You may implement your own script and mount under $0." + echo "Check out scripts in same folder or https://github.com/PhilippMundhenk/BrotherScannerDocker for examples." + +} >>/var/log/scanner.log 2>&1 diff --git a/script/scantoocr-0.2.4-1.sh b/script/scantoocr-0.2.4-1.sh index 6ed72c8..fc86ca2 100755 --- a/script/scantoocr-0.2.4-1.sh +++ b/script/scantoocr-0.2.4-1.sh @@ -4,9 +4,9 @@ { -echo "ERROR!" -echo "This function is not implemented." -echo "You may implement your own script and mount under $0." -echo "Check out scripts in same folder or https://github.com/PhilippMundhenk/BrotherScannerDocker for examples." + echo "ERROR!" + echo "This function is not implemented." + echo "You may implement your own script and mount under $0." + echo "Check out scripts in same folder or https://github.com/PhilippMundhenk/BrotherScannerDocker for examples." -} >> /var/log/scanner.log 2>&1 \ No newline at end of file +} >>/var/log/scanner.log 2>&1 diff --git a/script/trigger_inotify.sh b/script/trigger_inotify.sh index 4c6aeaa..4077b22 100755 --- a/script/trigger_inotify.sh +++ b/script/trigger_inotify.sh @@ -7,11 +7,10 @@ file=$5 if [ -z "${user}" ] || [ -z "${password}" ] || [ -z "${address}" ] || [ -z "${filepath}" ]; then echo "SSH environment variables not set, skipping inotify trigger." else - if sshpass -p "$password" ssh -o StrictHostKeyChecking=no $user@$address "sed \"\" -i $filepath/$file"; then + if sshpass -p "$password" ssh -o StrictHostKeyChecking=no "$user"@"$address" "sed \"\" -i $filepath/$file"; then echo "trigger inotify successful" else echo "trigger inotify failed" exit 1 fi fi - diff --git a/script/trigger_telegram.sh b/script/trigger_telegram.sh index 6280167..337953a 100755 --- a/script/trigger_telegram.sh +++ b/script/trigger_telegram.sh @@ -17,4 +17,4 @@ MESSAGE="Scanner: $1" ENCODED_MESSAGE=$(echo "$MESSAGE" | jq -sRr @uri) # Send the message using wget -wget -qO- --post-data="chat_id=$CHAT_ID&text=$ENCODED_MESSAGE" "https://api.telegram.org/$TOKEN/sendMessage" > /dev/null +wget -qO- --post-data="chat_id=$CHAT_ID&text=$ENCODED_MESSAGE" "https://api.telegram.org/$TOKEN/sendMessage" >/dev/null