From 6ec00d49b3e1510fb3edb2122524dd7c606ddf74 Mon Sep 17 00:00:00 2001 From: "Kay Marquardt (Gnadelwartz)" Date: Fri, 16 Oct 2020 10:53:08 +0200 Subject: [PATCH] remove JSON.sh -s option to fix message newline conversion on ubuntu --- addons/example.sh | 2 +- bashbot.rc | 2 +- bashbot.sh | 14 +++++++------- doc/0_install.md | 2 +- doc/4_expert.md | 2 +- doc/5_practice.md | 2 +- doc/6_reference.md | 2 +- doc/7_develop.md | 2 +- examples/background-scripts/run_diskusage.sh | 2 +- examples/background-scripts/run_filecontent.sh | 2 +- examples/background-scripts/run_filename.sh | 2 +- examples/bashbot-multi.sh | 2 +- examples/jsonDB-keyboard/mycommands.sh | 2 +- examples/send-system-status/mycommands.sh | 2 +- test/d-JSON.sh-test.sh | 2 +- 15 files changed, 21 insertions(+), 21 deletions(-) diff --git a/addons/example.sh b/addons/example.sh index 559a751..8e307a6 100644 --- a/addons/example.sh +++ b/addons/example.sh @@ -4,7 +4,7 @@ # Addons can register to bashbot events at startup # by providing their name and a callback per event # -#### $$VERSION$$ v1.0-0-g99217c4 +#### $$VERSION$$ v1.2-dev-13-g2a5d47d # # If an event occurs each registered event function is called. # diff --git a/bashbot.rc b/bashbot.rc index 91e96ab..6100154 100755 --- a/bashbot.rc +++ b/bashbot.rc @@ -1,7 +1,7 @@ #!/bin/sh # description: Start or stop telegram-bash-bot # -#### $$VERSION$$ v1.1-0-gc0eb399 +#### $$VERSION$$ v1.2-dev-13-g2a5d47d # shellcheck disable=SC2009 # shellcheck disable=SC2181 diff --git a/bashbot.sh b/bashbot.sh index cd6fd94..ace8cf0 100755 --- a/bashbot.sh +++ b/bashbot.sh @@ -11,7 +11,7 @@ # This file is public domain in the USA and all free countries. # Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying) # -#### $$VERSION$$ v1.1-0-gc0eb399 +#### $$VERSION$$ v1.2-dev-13-g2a5d47d # # Exit Codes: # - 0 success (hopefully) @@ -406,7 +406,7 @@ if [ -z "${BASHBOT_WGET}" ] && _exists curl ; then # shellcheck disable=SC2086 res="$("${BASHBOT_CURL}" -s -k ${BASHBOT_CURL_ARGS} -m "${TIMEOUT}"\ -d '{'"${chat} $(iconv -f utf-8 -t utf-8 -c <<<$2)"'}' -X POST "${3}" \ - -H "Content-Type: application/json" | "${JSONSHFILE}" -s -b -n 2>/dev/null )" + -H "Content-Type: application/json" | "${JSONSHFILE}" -b -n 2>/dev/null )" sendJsonResult "${res}" "sendJson (curl)" "$@" [ -n "${BASHBOT_EVENT_SEND[*]}" ] && event_send "send" "${@}" & } @@ -418,11 +418,11 @@ if [ -z "${BASHBOT_WGET}" ] && _exists curl ; then printf "%s: sendUpload CHAT=%s WHAT=%s FILE=%s CAPT=%s\n" "$(date)" "${1}" "${2}" "${3}" "${4}" >>"${UPDATELOG}" # shellcheck disable=SC2086 res="$("${BASHBOT_CURL}" -s -k ${BASHBOT_CURL_ARGS} "$4" -F "chat_id=$1"\ - -F "$2=@$3;${3##*/}" -F "caption=$5" | "${JSONSHFILE}" -s -b -n 2>/dev/null )" + -F "$2=@$3;${3##*/}" -F "caption=$5" | "${JSONSHFILE}" -b -n 2>/dev/null )" else # shellcheck disable=SC2086 res="$("${BASHBOT_CURL}" -s -k ${BASHBOT_CURL_ARGS} "$4" -F "chat_id=$1"\ - -F "$2=@$3;${3##*/}" | "${JSONSHFILE}" -s -b -n 2>/dev/null )" + -F "$2=@$3;${3##*/}" | "${JSONSHFILE}" -b -n 2>/dev/null )" fi sendJsonResult "${res}" "sendUpload (curl)" "$@" [ -n "${BASHBOT_EVENT_SEND[*]}" ] && event_send "upload" "$@" & @@ -442,7 +442,7 @@ else printf "%s: sendJson (wget) CHAT=%s JSON=%s URL=%s\n" "$(date)" "${1}" "${2:0:100}" "${3##*/}" >>"${UPDATELOG}" # shellcheck disable=SC2086 res="$(wget --no-check-certificate -t 2 -T "${TIMEOUT}" ${BASHBOT_WGET_ARGS} -qO - --post-data='{'"${chat} $(iconv -f utf-8 -t utf-8 -c <<<$2)"'}' \ - --header='Content-Type:application/json' "${3}" | "${JSONSHFILE}" -s -b -n 2>/dev/null )" + --header='Content-Type:application/json' "${3}" | "${JSONSHFILE}" -b -n 2>/dev/null )" sendJsonResult "${res}" "sendJson (wget)" "$@" [ -n "${BASHBOT_EVENT_SEND[*]}" ] && event_send "send" "${@}" & } @@ -564,7 +564,7 @@ title2Json(){ # get bot name getBotName() { - getJson "$ME_URL" | "${JSONSHFILE}" -s -b -n 2>/dev/null | JsonGetString '"result","username"' + getJson "$ME_URL" | "${JSONSHFILE}" -b -n 2>/dev/null | JsonGetString '"result","username"' } # pure bash implementation, done by KayM (@gnadelwartz) @@ -963,7 +963,7 @@ start_bot() { # adaptive sleep in ms rounded to next 0.1 s sleep "$(_round_float "${nextsleep}e-3" "1")" # get next update - UPDATE="$(getJson "$UPD_URL$OFFSET" "nolog" 2>/dev/null | "${JSONSHFILE}" -s -b -n 2>/dev/null | iconv -f utf-8 -t utf-8 -c)" + UPDATE="$(getJson "$UPD_URL$OFFSET" "nolog" 2>/dev/null | "${JSONSHFILE}" -b -n 2>/dev/null | iconv -f utf-8 -t utf-8 -c)" # did we get an response? if [ -n "${UPDATE}" ]; then # we got something, do processing diff --git a/doc/0_install.md b/doc/0_install.md index 689bc22..a273f17 100644 --- a/doc/0_install.md +++ b/doc/0_install.md @@ -10,7 +10,7 @@ Run the following commands to see if your bash looks ok ... if which bash; then echo "bash seems available..."; else echo "NO bash"; fi # real bash supports ARRAY -bash -c 'if eval "a=(1)"; then echo "Shell support arrays..."; else echo "Shell has NO arrays"; fi' +bash -c 'if eval "a[1]=1"; then echo "Shell support arrays..."; else echo "Shell has NO arrays"; fi' # check for bash version by feature bash -c 'if [ "$(echo -e "\u1111")" != "\u1111" ]; then echo "Bash version ok ..."; else echo "LBash Version may be to old ..."; fi' diff --git a/doc/4_expert.md b/doc/4_expert.md index 90059b8..3f08ebe 100644 --- a/doc/4_expert.md +++ b/doc/4_expert.md @@ -378,5 +378,5 @@ for every poll until the maximum of BASHBOT_SLEEP ms. #### [Prev Advanced Use](3_advanced.md) #### [Next Best Practice](5_practice.md) -#### $$VERSION$$ v1.0-0-g99217c4 +#### $$VERSION$$ v1.2-dev-13-g2a5d47d diff --git a/doc/5_practice.md b/doc/5_practice.md index f0e3c5d..dcdc963 100644 --- a/doc/5_practice.md +++ b/doc/5_practice.md @@ -158,5 +158,5 @@ The second warning is about an unused variable, this is true because in our exam #### [Prev Best Practice](5_practice.md) #### [Next Functions Reference](6_reference.md) -#### $$VERSION$$ v1.0-0-g99217c4 +#### $$VERSION$$ v1.2-dev-13-g2a5d47d diff --git a/doc/6_reference.md b/doc/6_reference.md index add13f7..4288f31 100644 --- a/doc/6_reference.md +++ b/doc/6_reference.md @@ -1049,5 +1049,5 @@ The name of your bot is available as bash variable "$ME", there is no need to ca #### [Prev Best Practice](5_practice.md) #### [Next Notes for Developers](7_develop.md) -#### $$VERSION$$ v1.0-0-g99217c4 +#### $$VERSION$$ v1.2-dev-13-g2a5d47d diff --git a/doc/7_develop.md b/doc/7_develop.md index 8161f9f..43cc2bc 100644 --- a/doc/7_develop.md +++ b/doc/7_develop.md @@ -347,5 +347,5 @@ fi #### [Prev Function Reference](6_reference.md) -#### $$VERSION$$ v1.0-0-g99217c4 +#### $$VERSION$$ v1.2-dev-13-g2a5d47d diff --git a/examples/background-scripts/run_diskusage.sh b/examples/background-scripts/run_diskusage.sh index 9fc6ce8..228b1fc 100755 --- a/examples/background-scripts/run_diskusage.sh +++ b/examples/background-scripts/run_diskusage.sh @@ -4,7 +4,7 @@ # # This file is public domain in the USA and all free countries. # Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying) -#### $$VERSION$$ v1.0-0-g99217c4 +#### $$VERSION$$ v1.2-dev-13-g2a5d47d ###### # parameters diff --git a/examples/background-scripts/run_filecontent.sh b/examples/background-scripts/run_filecontent.sh index 9142d0d..2daf1f2 100755 --- a/examples/background-scripts/run_filecontent.sh +++ b/examples/background-scripts/run_filecontent.sh @@ -2,7 +2,7 @@ # file: run_filename # background job to display content of all new files in WATCHDIR # -#### $$VERSION$$ v1.0-0-g99217c4 +#### $$VERSION$$ v1.2-dev-13-g2a5d47d ###### # parameters diff --git a/examples/background-scripts/run_filename.sh b/examples/background-scripts/run_filename.sh index b89cfe2..daf56ca 100755 --- a/examples/background-scripts/run_filename.sh +++ b/examples/background-scripts/run_filename.sh @@ -2,7 +2,7 @@ # file: run_filename # background job to display all new files in WATCHDIR # -#### $$VERSION$$ v1.0-0-g99217c4 +#### $$VERSION$$ v1.2-dev-13-g2a5d47d ###### # parameters diff --git a/examples/bashbot-multi.sh b/examples/bashbot-multi.sh index 122db50..7ae8de8 100755 --- a/examples/bashbot-multi.sh +++ b/examples/bashbot-multi.sh @@ -2,7 +2,7 @@ # file. multibot.sh # description: run multiple telegram bots from one installation # -#### $$VERSION$$ v1.0-0-g99217c4 +#### $$VERSION$$ v1.2-dev-13-g2a5d47d if [ "${2}" = "" ] || [ "${2}" = "-h" ]; then echo "Usage: $0 botname command" diff --git a/examples/jsonDB-keyboard/mycommands.sh b/examples/jsonDB-keyboard/mycommands.sh index 3dec529..032eb14 100644 --- a/examples/jsonDB-keyboard/mycommands.sh +++ b/examples/jsonDB-keyboard/mycommands.sh @@ -2,7 +2,7 @@ # files: mycommands.sh.dist # copy to mycommands.sh and add all your commands and functions here ... # -#### $$VERSION$$ v1.0-0-g99217c4 +#### $$VERSION$$ v1.2-dev-13-g2a5d47d # # shellcheck disable=SC2154 # shellcheck disable=SC2034 diff --git a/examples/send-system-status/mycommands.sh b/examples/send-system-status/mycommands.sh index dcf7fee..0ed8d77 100644 --- a/examples/send-system-status/mycommands.sh +++ b/examples/send-system-status/mycommands.sh @@ -5,7 +5,7 @@ # to show how you can customize bashbot by only editing mycommands.sh # NOTE: this is not tested, simply copied from original source and reworked! # -#### $$VERSION$$ v1.0-0-g99217c4 +#### $$VERSION$$ v1.2-dev-13-g2a5d47d # # shellcheck disable=SC2154 # shellcheck disable=SC2034 diff --git a/test/d-JSON.sh-test.sh b/test/d-JSON.sh-test.sh index f5534ae..2d99f70 100755 --- a/test/d-JSON.sh-test.sh +++ b/test/d-JSON.sh-test.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -#### $$VERSION$$ v1.0-0-g99217c4 +#### $$VERSION$$ v1.2-dev-13-g2a5d47d # include common functions and definitions # shellcheck source=test/ALL-tests.inc.sh