[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: Tom Rini <trini_at_kernel.crashing.org>
Date: 2002-02-09 19:39:37 CET

On Sat, Feb 09, 2002 at 10:28:31AM -0800, Zack Weinberg wrote:
> 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

Only a return code, yes? Can we use 'test' ?

[snip]
> 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.

It's not as 'nice' I suppose. If true, do nothing, else do something
doesn't seem as nice as if false, do something.

-- 
Tom Rini (TR1265)
http://gate.crashing.org/~trini/
---------------------------------------------------------------------
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.