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

Re: [PATCH] if ! is not portable

From: Zack Weinberg <zack_at_codesourcery.com>
Date: 2002-02-09 19:28:31 CET

On Sat, Feb 09, 2002 at 07:21:10PM +0100, Sander Striker wrote:
> > From: Blair Zajac [mailto:blair@orcaware.com]
> > Sent: 09 February 2002 18:42
>
> > Sander Striker wrote:
> > > I would suggest:
> > >
> > >
> > >
> > > instead.
> >
> > Except this passes cmp -s .... to test, which doesn't execute cmp.
>
> /me asking stupid questions...
>
> What about:
>
> if [ ! `cmp -s ./ac-helpers/find_apr.m4 ./apr/build/find_apr.m4` ]; then

cmp -s produces no output, so this reduces to

if [ ! ]

which is a run-time syntax error.

The only other portable way to do this is

cmp -s ./ac-helpers/find_apr.m4 ./apr/build/find_apr.m4
if [ $? -ne 0 ]; then

I don't see what was wrong with

if cmp -s ./ac-helpers/find_apr.m4 ./apr/build/find_apr.m4
then :
else

it's a common idiom.

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.