shellcheck tweaks
This commit is contained in:
parent
fa119a8d4f
commit
d7accc8c69
3 changed files with 13 additions and 12 deletions
19
buttons.sh
19
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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue