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

Re: [PATCH] echo -n is not portable and used too much

From: Zack Weinberg <zack_at_codesourcery.com>
Date: 2002-02-12 00:46:17 CET

On Mon, Feb 11, 2002 at 05:20:49PM -0600, Karl Fogel wrote:
> Blair Zajac <blair@orcaware.com> writes:
> > On Solaris, running make check results in output like this:
> >
> > make check
> > -n Running all tests in path-test...
> > SUCCESS
> > -n Running all tests in random-test...
> > SUCCESS
> > -n Running all tests in hashdump-test...
> > SUCCESS
>
> Hmmmm.
>
> What would be the normal way to get the same effect on Solaris?

echo "Running all tests in path-test...\c"

This isn't portable either. Some shells (and /bin/echo-s) support
only \c, some support only -n, some support neither.

autoconf-generated configure scripts have this near the beginning:

if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
    ac_n= ac_c='
' ac_t=' '
  else
    ac_n=-n ac_c= ac_t=
  fi
else
  ac_n= ac_c='\c' ac_t=
fi

and then they do

echo $ac_n "Running all tests in path-test...$ac_c"
# ...
echo "${ac_t}SUCCESS"

zw

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:37:06 2006

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.