diff mbox series

[libgpiod,5/8] tools: tests: don't use variables in printf format string

Message ID 20240531134512.443850-6-warthog618@gmail.com
State Superseded
Headers show
Series tools: tests: fix shellcheck warnings | expand

Commit Message

Kent Gibson May 31, 2024, 1:45 p.m. UTC
Fix shellcheck SC2059[1] - don't use variables in the printf format
string.

Signed-off-by: Kent Gibson <warthog618@gmail.com>

[1] https://www.shellcheck.net/wiki/SC2059
---
 tools/gpio-tools-test.bash | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/tools/gpio-tools-test.bash b/tools/gpio-tools-test.bash
index efe558b..d9930f1 100755
--- a/tools/gpio-tools-test.bash
+++ b/tools/gpio-tools-test.bash
@@ -3048,7 +3048,7 @@  die() {
 oneTimeSetUp() {
 	test "$SHUNIT_VERSION" = "$MIN_SHUNIT_VERSION" && return 0
 	local FIRST
-	FIRST=$(printf "$SHUNIT_VERSION\n$MIN_SHUNIT_VERSION\n" | sort -Vr | head -1)
+	FIRST=$(printf "%s\n%s\n" "$SHUNIT_VERSION" "$MIN_SHUNIT_VERSION" | sort -Vr | head -1)
 	test "$FIRST" = "$MIN_SHUNIT_VERSION" && \
 		die "minimum shunit version required is $MIN_SHUNIT_VERSION (current version is $SHUNIT_VERSION"
 }
@@ -3058,7 +3058,7 @@  check_kernel() {
 	local CURRENT
 	CURRENT=$(uname -r)
 
-	SORTED=$(printf "$REQUIRED\n$CURRENT" | sort -V | head -n 1)
+	SORTED=$(printf "%s\n%s" "$REQUIRED" "$CURRENT" | sort -V | head -n 1)
 
 	if [ "$SORTED" != "$REQUIRED" ]
 	then