Re: [PATCH] test-lib.sh: use printf instead of echo
From: David Kastrup <hidden>
Date: 2016-06-15 23:00:22
Junio C Hamano [off-list ref] writes:
Jonathan Nieder [off-list ref] writes:quoted
Junio C Hamano wrote:quoted
quoted
Uwe Storbeck wrote:quoted
quoted
quoted
+ printf '%s\n' "$@" | sed -e 's/^/# /'This is wrong, isn't it? Why do we want one line per item here?Yes, Hannes caught the same, too. Sorry for the sloppiness. We currently use "echo" all over the place (e.g., 'echo "$path"' in git-sh-setup), and every time we fix it there is a chance of making mistakes. I wonder if it would make sense to add a helper to make the echo calls easier to replace:I agree that we would benefit from having a helper to print a single line, which we very often do, without having to worry about the boilerplate '%s\n' of printf or the portability gotcha of echo. I am a bit reluctant to name the helper "sane_echo" to declare "echo that interprets backslashes in the string is insane", though.
raw_echo -- David Kastrup