Howto force winXP use cygwin "if test -n"

Dave Korn dave.korn@artimi.com
Tue Aug 28 12:28:00 GMT 2007


On 28 August 2007 01:47, Hugo Martin (Tourbillon Enterprises) wrote:

> Hello.
> 
> I need to use cygwin's "if" command, the ruby gem I need to install tries to
> run "if test -n" in my winXP but the win32 "if" is used so it fails with "-n
> was unexpected at this time".
> 
> Is it possible to force WinXP to use cygwin's "if"?  c:\cygwin\bin is on the
> PATH

  There is no such thing as "Cygwin's if".  The 'if' command is a bash shell
builtin.  It does not exist as a separate executable.  It can only be invoked
from within bash.

> If it's helpful here is the error:
> 
> c:\> gem install rmagick --include-dependencies
> ....[snip].......................................
> ...
> config.status: creating ext/RMagick/rmagick_config.h
> 
> This installation of RMagick 1.15.9 is configured for
>  and ImageMagick 6.3.0.patchlevel 0) [i386-mswin32]
> RMagick configuration completed successfully.
> 
> nmake
> 
> Microsoft (R) Program Maintenance Utility   Version 6.00.8168.0
> Copyright (C) Microsoft Corp 1988-1998. All rights reserved.
> 
>         if test -n "c:/ruby/lib/ruby/gems/1.8/gems/rmagick-1.15.9/lib"; then
> RUBYLIBDIR=--rbdir="c:/ruby/lib/ruby/gems/
> 1.8/gems/rmagick-1.15.9/lib";  fi;  if test -n
> "c:/ruby/lib/ruby/gems/1.8/gems/rmagick-1.15.9/lib"; then  RUBYARCHDIR=--
> sodir="c:/ruby/lib/ruby/gems/1.8/gems/rmagick-1.15.9/lib";  fi;
> /cygdrive/c/ruby/bin/ruby setup.rb config $RUBYLIBDIR $
> RUBYARCHDIR
> -n was unexpected at this time.
> NMAKE : fatal error U1077: 'if' : return code '0x1'
> Stop.
> 
> Gem files will remain installed in
> c:/ruby/lib/ruby/gems/1.8/gems/rmagick-1.15.9 for inspection.
> Results logged to c:/ruby/lib/ruby/gems/1.8/gems/rmagick-1.15.9/gem_make.out

  Ah, right, I think that's error code EYOUARENUTS.... how on earth do you think
you can run a bash-specific shell script in cmd.exe?  The syntax is totally
different.  Not being able to get at "cygwin's if" command is the least of your
worries.

> In the CygWin console:
> $ if test -n
>> 
> 
> In winXP cmd console:
> C:\ruby\lib\ruby\gems\1.8\gems>if test -n
> -n was unexpected at this time.

  Yeh, see, cmd.exe also has a built-in "if" command, and it uses an utterly
different syntax.  Whatever it is you think you're doing, you are doing it wrong!

  Perhaps you should elaborate on the real underlying problem, rather than just
showing us a symptom and asking for a cure based on your own unstated false
diagnosis.


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list