[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] for sh portability issue in davautocheck.sh

From: Alan Barrett <apb_at_cequrux.com>
Date: 2007-03-27 10:19:37 CEST

On Mon, 26 Mar 2007, Peter Samuelson wrote:
> * Don't use "echo -n", do the dance to figure out whether to use -n
> or \c. I believe POSIX declined to settle the matter either way.

It's even worse than that. POSIX declared that anything starting
with -n or anything containing a backslash anywhere can invoke
implementation-defined behaviour. The recommended POSIX-portable thing
to do is to use 'printf "%s\n" "${string}"' when you want a newline, and
'printf "%s" "${string}"' when you don't want a newline.

So, define echo_n like this:

echo_n()
{
    printf "%s" "$*"
}

--apb (Alan Barrett)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Mar 27 10:20:05 2007

This is an archived mail posted to the Subversion Dev mailing list.