Skip to content

Commit

Permalink
lib/path/tests: Fix property tests when "-n" is generated
Browse files Browse the repository at this point in the history
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
  • Loading branch information
infinisil committed Jan 10, 2023
1 parent b326f62 commit 041b044
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/path/tests/prop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit 041b044

Please sign in to comment.