diff --git a/bashbot.rc b/bashbot.rc index bf895c7..7044f46 100755 --- a/bashbot.rc +++ b/bashbot.rc @@ -5,7 +5,7 @@ # # tested on: ubuntu, opensuse, debian # -#### $$VERSION$$ v1.21-0-gc85af77 +#### $$VERSION$$ v1.25-dev-9-g14fa2c7 # shellcheck disable=SC2009 # shellcheck disable=SC2181 @@ -30,8 +30,8 @@ runcmd="echo Dry run:" # not activated until you edit lines below runas="nobody" # uncomment one of the example lines to fit your system -# runcmd="su $runas -s /bin/bash -c " # runasuser with *su* -# runcmd="runuser $runas -s /bin/bash -c " # runasuser with *runuser* +# runcmd="su ${runas} -s /bin/bash -c " # runasuser with *su* +# runcmd="runuser ${runas} -s /bin/bash -c " # runasuser with *runuser* # edit the values of the following lines to fit your config: start="cd /usr/local/telegram-bot-bash; /usr/local/telegram-bot-bash/bashbot.sh" # location of your bashbot.sh script @@ -40,24 +40,26 @@ name='' # your bot name as given to botfather, e.g. mysomething_bot # END Configuration ####################### -[ "$name" = "" ] && name="$runas" +[ "${name}" = "" ] && name="${runas}" case "$1" in 'start') + # shellcheck disable=SC2250 $runcmd "$start start" # >/dev/null 2>&1 /dev/null 2>&1 + kill -9 $(ps -u "${runas}" | grep inotifywait | sed 's/ .*//') >/dev/null 2>&1 fi ;; *) @@ -83,4 +86,4 @@ case "$1" in RETVAL=1 ;; esac -exit $RETVAL +exit "${RETVAL}" diff --git a/dev/hooks/post-commit.sh b/dev/hooks/post-commit.sh index e8ad88c..038ee15 100755 --- a/dev/hooks/post-commit.sh +++ b/dev/hooks/post-commit.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -#### $$VERSION$$ v1.21-0-gc85af77 +#### $$VERSION$$ v1.25-dev-9-g14fa2c7 ############ # NOTE: you MUST run install-hooks.sh again when updating this file! @@ -7,7 +7,7 @@ # magic to ensure that we're always inside the root of our application, # no matter from which directory we'll run script GIT_DIR=$(git rev-parse --git-dir) -cd "$GIT_DIR/.." || exit 1 +cd "${GIT_DIR}/.." || exit 1 export HOOKDIR="dev/hooks" LASTPUSH='.git/.lastcommit' diff --git a/dev/hooks/pre-commit.sh b/dev/hooks/pre-commit.sh index 8880d05..0e3082c 100755 --- a/dev/hooks/pre-commit.sh +++ b/dev/hooks/pre-commit.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -#### $$VERSION$$ v1.21-0-gc85af77 +#### $$VERSION$$ v1.25-dev-9-g14fa2c7 ############ # NOTE: you MUST run install-hooks.sh again when updating this file! @@ -7,7 +7,7 @@ # magic to ensure that we're always inside the root of our application, # no matter from which directory we'll run script GIT_DIR=$(git rev-parse --git-dir) -cd "$GIT_DIR/.." || exit 1 +cd "${GIT_DIR}/.." || exit 1 export HOOKDIR="dev/hooks" LASTPUSH='.git/.lastpush' @@ -32,9 +32,9 @@ set +f FILES="$(find ./* -name '*.sh' | grep -v -e 'DIST\/' -e 'STANDALONE\/' -e 'JSON.sh')" set -f FILES="${FILES} $(sed '/^#/d' <"dev/shellcheck.files")" -if [ "$FILES" != "" ]; then +if [ "${FILES}" != "" ]; then # shellcheck disable=SC2086 - shellcheck -x ${FILES} || exit 1 + shellcheck -o all -e SC2249,SC2154 -x ${FILES} || exit 1 printf " OK\n............................\n" else # something went wrong diff --git a/dev/hooks/pre-push.sh b/dev/hooks/pre-push.sh index 26f4658..a0f6912 100755 --- a/dev/hooks/pre-push.sh +++ b/dev/hooks/pre-push.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -#### $$VERSION$$ v1.21-0-gc85af77 +#### $$VERSION$$ v1.25-dev-9-g14fa2c7 ############ # NOTE: you MUST run install-hooks.sh again when updating this file! @@ -7,7 +7,7 @@ # magic to ensure that we're always inside the root of our application, # no matter from which directory we'll run script GIT_DIR=$(git rev-parse --git-dir) -cd "$GIT_DIR/.." || exit 1 +cd "${GIT_DIR}/.." || exit 1 export HOOKDIR="dev/hooks" LASTPUSH='.git/.lastpush' diff --git a/mycommands.sh.clean b/mycommands.sh.clean index eae37af..d744161 100644 --- a/mycommands.sh.clean +++ b/mycommands.sh.clean @@ -4,7 +4,7 @@ # files: mycommands.sh.clean # copy to mycommands.sh and add all your commands and functions here ... # -#### $$VERSION$$ v1.25-dev-0-gd310805 +#### $$VERSION$$ v1.25-dev-9-g14fa2c7 # ########## @@ -108,7 +108,7 @@ else ################## # example command, replace them by your own '/echo'*) # example echo command - send_normal_message "${CHAT[ID]}" "$MESSAGE" + send_normal_message "${CHAT[ID]}" "${MESSAGE}" ;; ########## @@ -152,10 +152,10 @@ else local image result sep="" count="1" result="$(wget --user-agent 'Mozilla/5.0' -qO - "https://images.search.yahoo.com/search/images?p=$1" | sed 's/