delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/11/11/08:09:23

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: "Dave Korn" <dk AT artimi DOT com>
To: <cygwin AT cygwin DOT com>
Subject: RE: if construct doesn't work in makefile
Date: Thu, 11 Nov 2004 13:07:34 -0000
MIME-Version: 1.0
In-Reply-To: <D7FBE8A336018A4EB5EBDC6C898821930991C931@HUELVA.belgium.fhm.de>
Message-ID: <NUTMEGQvdzhs1eAjT4300000686@NUTMEG.CAM.ARTIMI.COM>
X-OriginalArrivalTime: 11 Nov 2004 13:07:34.0093 (UTC) FILETIME=[68B39FD0:01C4C7EF]

> -----Original Message-----
> From: cygwin-owner On Behalf Of Morche Matthias
> Sent: 11 November 2004 12:22

> cygwin-ownerOOOPScygwinBADOINGGGG!com wrote:

  Matthias, http://cygwin.com/acronyms#PCYMTNQREAIYR, thanks!

> >   In my make file I am trying to check whether a directory exists or
> > not then set a path differently if doesn't exist.
> >   I am using cygwin installed on windows 2000.
> >   The if construct I have is as follows.
> > 
> >   if test [-dc:/tools]; then DRIVE = c:/tools; else DRIVE =
> > c:/altTools; fi 
> > 
> >  pls help me out.
> > 
> > Regards,
> > sitaram
> 
> Does the following work better?
> if test [ -d /cygdrive/C/tools ]; then DRIVE=c:/tools; else DRIVE=

  I thought it would be that as well, but in fact test seems to be happy with no
spaces around the square brackets.  I think it may be only if you want to use
the implicit form of test that the brackets need to be separated with spaces
from the test inside them, so that bash spots them as a separate token.

dk AT mace /tmp/bgcc> if [-dc:/baar]; then FRED=yes; else FRED=no; fi
bash: [-dc:/baar]: No such file or directory
dk AT mace /tmp/bgcc> if [ -dc:/baar ]; then FRED=yes; else FRED=no; fi
dk AT mace /tmp/bgcc> if test [-dc:/baar]; then FRED=yes; else FRED=no; fi
dk AT mace /tmp/bgcc>

  Yep, that looks fairly conclusive to me.

    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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019