diff --git a/buttons.sh b/buttons.sh index 5c3bce1..9eba770 100755 --- a/buttons.sh +++ b/buttons.sh @@ -1,15 +1,16 @@ #!/bin/bash -export ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -button=$1 +ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +export ROOT=ROOT +button="$1" debug(){ debug=$ROOT/debug # todo: # this keeps the log file at 30 lines but breaks the pipe when doing "tail -F debug" tail -n 30 $debug > debug.tmp && mv debug.tmp $debug - echo $1 - echo $1>>$debug + echo "$1" + echo "$1">>$debug } active=$(bash $ROOT/get_active_window.sh) @@ -28,18 +29,18 @@ else fi ### find and run $1 -if [[ $(type -t $active) == function ]]; then +if [[ $(type -t "$active") == function ]]; then debug "found $active methods" - $active + "$active" else debug "no $button method found in $active" fi -if [[ $(type -t $button) == function ]]; then +if [[ $(type -t "$button") == function ]]; then debug "found $button" - $1 + "$1" else debug "program specific method not found calling all $button" - all $1 + all "$1" fi diff --git a/find_or_open.sh b/find_or_open.sh index 3d0a0b6..0cef0bd 100755 --- a/find_or_open.sh +++ b/find_or_open.sh @@ -10,6 +10,6 @@ find_or_open(){ fi } -if [[ ! -z $1 ]]; then - find_or_open $1 +if [[ -n $1 ]]; then + find_or_open "$1" fi diff --git a/init.sh b/init.sh index 1f40279..c1d0490 100755 --- a/init.sh +++ b/init.sh @@ -7,7 +7,7 @@ rm /home/htpc/.kodi/userdata/keymaps/keyboard.xml ln /home/htpc/scripts/PJ/xml/keyboard.xml /home/htpc/.kodi/userdata/keymaps/keyboard.xml rm /home/htpc/.kodi/userdata/advancedsettings.xml -export $(grep -v '^#' /home/htpc/scripts/PJ/secrets.env | xargs) +export "$(grep -v '^#' /home/htpc/scripts/PJ/secrets.env | xargs)" envsubst < /home/htpc/scripts/PJ/xml/advancedsettings.xml > /home/htpc/.kodi/userdata/advancedsettings.xml # disable the power button on PJ, ignore if already commented