From 041b044a663a52e1c885c00496b44c5ba5982597 Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Tue, 10 Jan 2023 14:18:35 +0100 Subject: [PATCH] lib/path/tests: Fix property tests when "-n" is generated When "-n" is generated by the property tests, it causes `echo` to not output the string since it's interpreted as an option. Apparently there's no good way to print "-n" with `echo` [1], so switching to `printf` instead [1]: https://unix.stackexchange.com/questions/85846/how-can-i-print-n-with-echo --- lib/path/tests/prop.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/path/tests/prop.sh b/lib/path/tests/prop.sh index c956e55bbfa..e48c6667fa0 100755 --- a/lib/path/tests/prop.sh +++ b/lib/path/tests/prop.sh @@ -55,7 +55,7 @@ fi declare -a strings=() mkdir -p "$tmp/strings" while IFS= read -r -d $'\0' str; do - echo -n "$str" > "$tmp/strings/${#strings[@]}" + printf "%s" "$str" > "$tmp/strings/${#strings[@]}" strings+=("$str") done < <(awk \ -f "$SCRIPT_DIR"/generate.awk \