You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Greg Hudson <gh...@MIT.EDU> on 2004/09/18 15:41:21 UTC

Re: svn commit: r11027 - trunk

On Fri, 2004-09-17 at 17:08, breser@tigris.org wrote:
> +type pax &> /dev/null
> +if [ ! $? ] && [ -z "$ZIP" ]; then

This redirection syntax is bash-specific and the [ ! $? ] test simply
won't work, since "test" is not like C.

  type pax > /dev/null 2>&1
  if [ $? -ne 0 ] && [ -z "$ZIP" ]; then

I would suggest the somewhat cooler:

  if [ -z "$ZIP" ] && ! type pax > /dev/null 2>&1; then

but it won't work with deficient /bin/sh implementations like Solaris's,
although it should work with any POSIX shell (such as the
/usr/xpg4/bin/sh on Solaris).


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: r11027 - trunk

Posted by Greg Hudson <gh...@MIT.EDU>.
On Tue, 2004-09-28 at 18:02, Ben Reser wrote:
> On Sat, Sep 18, 2004 at 11:41:21AM -0400, Greg Hudson wrote:
> > On Fri, 2004-09-17 at 17:08, breser@tigris.org wrote:
> > > +type pax &> /dev/null
> > > +if [ ! $? ] && [ -z "$ZIP" ]; then
> > 
> > This redirection syntax is bash-specific and the [ ! $? ] test simply
> > won't work, since "test" is not like C.
> > 
> >   type pax > /dev/null 2>&1
> >   if [ $? -ne 0 ] && [ -z "$ZIP" ]; then
> 
> Yup sorry about that.  I was thinking dist.sh was already bash specific.
> Guess it wasn't will fix.

You seem to have misunderstood a little; the [ ! $? ] syntax won't work
with or without bash.  Try it:

  false; [ ! $? ] && echo foo
  true; [ ! $? ] && echo foo

(Either way, it's fine now, of course.)


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: r11027 - trunk

Posted by Ben Reser <be...@reser.org>.
On Sat, Sep 18, 2004 at 11:41:21AM -0400, Greg Hudson wrote:
> On Fri, 2004-09-17 at 17:08, breser@tigris.org wrote:
> > +type pax &> /dev/null
> > +if [ ! $? ] && [ -z "$ZIP" ]; then
> 
> This redirection syntax is bash-specific and the [ ! $? ] test simply
> won't work, since "test" is not like C.
> 
>   type pax > /dev/null 2>&1
>   if [ $? -ne 0 ] && [ -z "$ZIP" ]; then

Yup sorry about that.  I was thinking dist.sh was already bash specific.
Guess it wasn't will fix.

> I would suggest the somewhat cooler:
> 
>   if [ -z "$ZIP" ] && ! type pax > /dev/null 2>&1; then
> 
> but it won't work with deficient /bin/sh implementations like Solaris's,
> although it should work with any POSIX shell (such as the
> /usr/xpg4/bin/sh on Solaris).

Which mean we might as well just use the former.


-- 
Ben Reser <be...@reser.org>
http://ben.reser.org

"Conscience is the inner voice which warns us somebody may be looking."
- H.L. Mencken

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org