shellcheck tweaks

This commit is contained in:
fred 2025-06-18 09:47:16 -07:00
parent fa119a8d4f
commit d7accc8c69
3 changed files with 13 additions and 12 deletions

View file

@ -1,15 +1,16 @@
#!/bin/bash #!/bin/bash
export ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
button=$1 export ROOT=ROOT
button="$1"
debug(){ debug(){
debug=$ROOT/debug debug=$ROOT/debug
# todo: # todo:
# this keeps the log file at 30 lines but breaks the pipe when doing "tail -F debug" # 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 tail -n 30 $debug > debug.tmp && mv debug.tmp $debug
echo $1 echo "$1"
echo $1>>$debug echo "$1">>$debug
} }
active=$(bash $ROOT/get_active_window.sh) active=$(bash $ROOT/get_active_window.sh)
@ -28,18 +29,18 @@ else
fi fi
### find and run $1 ### find and run $1
if [[ $(type -t $active) == function ]]; then if [[ $(type -t "$active") == function ]]; then
debug "found $active methods" debug "found $active methods"
$active "$active"
else else
debug "no $button method found in $active" debug "no $button method found in $active"
fi fi
if [[ $(type -t $button) == function ]]; then if [[ $(type -t "$button") == function ]]; then
debug "found $button" debug "found $button"
$1 "$1"
else else
debug "program specific method not found calling all $button" debug "program specific method not found calling all $button"
all $1 all "$1"
fi fi

View file

@ -10,6 +10,6 @@ find_or_open(){
fi fi
} }
if [[ ! -z $1 ]]; then if [[ -n $1 ]]; then
find_or_open $1 find_or_open "$1"
fi fi

View file

@ -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 ln /home/htpc/scripts/PJ/xml/keyboard.xml /home/htpc/.kodi/userdata/keymaps/keyboard.xml
rm /home/htpc/.kodi/userdata/advancedsettings.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 envsubst < /home/htpc/scripts/PJ/xml/advancedsettings.xml > /home/htpc/.kodi/userdata/advancedsettings.xml
# disable the power button on PJ, ignore if already commented # disable the power button on PJ, ignore if already commented