commit d5372d7b85e44469bb0add410410348d88f3be6d
parent 359705cd0bacac3d120298d1006592ba6d6348f3
Author: Anton Konyahin <me@konyahin.xyz>
Date: Fri, 1 Mar 2024 14:29:09 +0300
scripts: fix shellcheck warnings for skefir
Diffstat:
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/scripts/dot-bin/skefir b/scripts/dot-bin/skefir
@@ -7,7 +7,7 @@ if [ "$#" -lt 2 ]; then
exit 1
fi
-if [ "$1" == "-n" ]; then
+if [ "$1" = "-n" ]; then
NO_MAP=true
shift
fi
@@ -17,12 +17,12 @@ link () {
LINE=$2
ARGS=$3
- printf "[%3d] " $LINK
+ printf "[%3d] " "$LINK"
echo "$LINE" | awk -F '\t' '{print substr($1, 2)}'
KEFIR_CALL="$(echo "$LINE" | awk -F '\t' '{printf "%s %s", $3, $2}')"
- COMMAND="$LINK shell ./skefir $ARGS $KEFIR_CALL"
- echo "\n$COMMAND" >> "$LESSKEY_FILE"
+ COMMAND="$LINK shell skefir $ARGS $KEFIR_CALL"
+ printf "%s\n" "$COMMAND" >> "$LESSKEY_FILE"
}
viewer () {
@@ -50,7 +50,7 @@ viewer () {
LESSKEY_FILE=$(mktemp -t skefir.XXXXXX)
echo "#command" > "$LESSKEY_FILE"
-TEXT=$(printf "$2\r\n" | nc "$1" 70)
+TEXT=$(printf "%s\r\n" "$2" | nc "$1" 70)
[ -z "${NO_MAP:-}" ] && TEXT="$(echo "$TEXT" | viewer)"
echo "$TEXT" | less --lesskey-src="$LESSKEY_FILE"