Re: [PATCH] Replace "echo -n" with printf in shell scripts.
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:49
Simon 'corecode' Schubert [off-list ref] writes:
Junio C Hamano wrote:quoted
quoted
quoted
We have done this already so it might be too late to raise this question, but does everybody have printf?The problematic are less common ones, ranging from (not so less common) OSX, Solaris to (much less common) AIX that some people seem to run git on (or at least compile git for).printf(1) is part of POSIX/SUSv3, so systems *should* have it.
A lot of the portability problem we suffered were about the things that systems *should* have it. Unfortunately a standard does not matter a whit on its own when dealing with the real world. That's why I muttered the above even though I knew POSIX says you should have one. We use POSIX as one of the yardsticks to see what we should stay away (i.e. "that is not even in POSIX so let's not use it for now"), and also how far we are willing to bend over (i.e. "any reasonable system should have it; besides, it is in POSIX. Let's use it -- it is so convenient -- and insane platforms can screw themselves"). The key point in the latter is that "besides" is not "because".