git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] t/t9902-completion.sh: backslashes in echo

From
Marcel Telka <marcel@telka.sk>
Date
May 17, 2024, 14:08 UTC
Message-ID
<Zkdk7R9GIfsyQjkc@telcontar>

The usage of backslashes in echo is not portable. Since some tests tries to output strings containing '\b' it is safer to use printf here. The usage of printf instead of echo is also preferred by POSIX.

Signed-off-by: Marcel Telka <marcel@telka.sk>
---
 t/t9902-completion.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index 963f865f27..ed3d03367e 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -73,7 +73,7 @@ _get_comp_words_by_ref ()
 print_comp ()
 {
 	local IFS=$'\n'
-	echo "${COMPREPLY[*]}" > out
+	printf '%s\n' "${COMPREPLY[*]}" > out
 }
 
 run_completion ()
Next: Junio C Hamano
Message 1 of 10 in “t/t9902-completion.sh: backslashes in echo”
  1. t/t9902-completion.sh: backslashes in echoMarcel Telka, May 17, 2024
  2. Junio C HamanoMay 23, 2024
  3. Marcel TelkaMay 23, 2024
  4. Eric SunshineMay 23, 2024
  5. Marcel TelkaMay 23, 2024
  6. Marcel TelkaMay 23, 2024
  7. Marcel TelkaMay 23, 2024
  8. Junio C HamanoMay 23, 2024
  9. Eric SunshineMay 23, 2024
  10. Marcel TelkaMay 23, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.