Re: [PATCH] Avoid using non-portable `echo-n` in tests.
- From
- Steve Folly <steve@spfweb.co.uk>
- Date
- Oct 31, 2008, 09:36 UTC
- Message-ID
- <loom.20081031T093317-846@post.gmane.org>
- In-Reply-To
- <7vtzat89br.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster <at> pobox.com> writes:
Show 11 quoted lines
> > Brian Gernhardt <benji <at> silverinsanity.com> writes: > > > Not all /bin/sh have a builtin echo that recognizes -n. Using printf > > is far more portable. > > > > Discovered on OS X 10.5.5 in t4030-diff-textconv.sh and changed in all > > the test scripts. > > I had an impression that OS X was BSDish. Wasn't "echo -n" a BSDism? >
FYI, "man echo" on OS X 10.5.5 has this to say...
The following option is available:
-n Do not print the trailing newline character. This may also be
achieved by appending `\c' to the end of the string, as is done by
iBCS2 compatible systems. Note that this option as well as the
effect of `\c' are implementation-defined in IEEE Std 1003.1-2001
(``POSIX.1'') as amended by Cor. 1-2002. Applications aiming for
maximum portability are strongly encouraged to use printf(1) to
suppress the newline character. Some shells may provide a builtin echo command which is similar or iden-
tical to this utility. Most notably, the builtin echo in sh(1) does not
accept the -n option. Consult the builtin(1) manual page.Regards, Steve.