plugins for wvkbd using swipeGuess
scripts: Fix posix compliance for sb_picker and some shellcheck sniffs
Zach DeCook 2023-03-01
parent 9a3212a · commit ef36d59
-rwxr-xr-xsb_picker.sh4
-rwxr-xr-xsb_predictor.sh6
2 files changed, 5 insertions, 5 deletions
diff --git a/sb_picker.sh b/sb_picker.sh
index 69dda6e..908463b 100755
--- a/sb_picker.sh
+++ b/sb_picker.sh
@@ -8,7 +8,7 @@ cat 0<> "$sock"|suggpicker 2>/dev/null|completelyTypeWord.sh &
swipeGuess "$words" 5 | while read -r word; do
set -- $word
if test -n "$2"; then
- s1="$(echo "$1" | mapScore "$keymap" bee|cut -f1)"
+ s1="$(echo "$1" | mapScore "$keymap" bee |cut -f1)"
s2="$(echo "$2" | mapScore "$keymap" bee |cut -f1)"
cutoff="$(( ($s1 * 19 / 20) - 2 ))"
if [ "$s2" -lt "$cutoff" ]; then
@@ -21,7 +21,7 @@ swipeGuess "$words" 5 | while read -r word; do
fi
fi
if test "$1" && ! test "$2"; then
- wtype "${1:1}"
+ wtype "${1#?}"
elif ! test "$2"; then
echo "" >> "$sock"
else
diff --git a/sb_predictor.sh b/sb_predictor.sh
index 1cae0dd..990badb 100755
--- a/sb_predictor.sh
+++ b/sb_predictor.sh
@@ -49,13 +49,13 @@ while read -r swipe; do
if test -e "$lw"; then
printf " " >> "$lw"
rm -f "$complete"
- cat "$twow" | quick5 "$(cat "$lw")" >> "$sock"
+ quick5 "$(cat "$lw")" < "$twow" >> "$sock"
mv "$lw" "$tw"
fi
- elif test "$swipe" = "$(echo -e "\x08")"; then
+ elif test "$swipe" = "$(printf "\b")"; then
lastword="$(cat "$lw" 2>/dev/null)"
printf %s "$lastword" | sed 's/.$//g' > "$lw"
- elif test "$swipe" = "$(echo -e "\n")"; then
+ elif test "$swipe" = "$(printf "\n")"; then
rm -f "$lw" "$tw"
else
printf %s "$swipe" >> "$lw"