delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/10/05/06:22:27

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:in-reply-to:references:date
:message-id:subject:from:to:content-type; q=dns; s=default; b=jV
4kDqIfMrsZX464sm+dnbvrdDqH7hxW18Nj16dBzP5h/24mo15ApPKfxLNWgraO3R
MWoJ8o5Pw2l0XKYkCPpdhuCWiCyxXT4bPToEyRYkIxSjJEIIHXXD6iMj2Kzrydvw
tG/RMpBcaTGUemKzbuK5/uJetZN00S5QLRV1dXrC8=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:in-reply-to:references:date
:message-id:subject:from:to:content-type; s=default; bh=vzYlhrwb
tpr7EbTa2cfd/x9NPFE=; b=eLX98FiEUSUE0Pnx/YXpZHMjk2Fs2GiS/NfllBBZ
qE+VKkZpLTy7Sr0ddnM3GEQqmAehyft/uveiEX/XgAidC8hZsqh/ZjAhaAeVvcKD
U5itkIg9XWxEKQJPCKi9bRvY7mjAnA9fPUHUlnQH8fxyYagBNINw+cUUxcQ04bXv
UgM=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
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
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-0.4 required=5.0 tests=AWL,BAYES_40,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2
X-HELO: mail-qa0-f54.google.com
MIME-Version: 1.0
X-Received: by 10.224.125.4 with SMTP id w4mr24247222qar.75.1380968527808; Sat, 05 Oct 2013 03:22:07 -0700 (PDT)
In-Reply-To: <524FB2BB.40608@orange.fr>
References: <524FB2BB DOT 40608 AT orange DOT fr>
Date: Sat, 5 Oct 2013 12:22:07 +0200
Message-ID: <CAM9pMnMcQcp4prHqs5Bh1sCt0HGC1zaTcmHEXFPrj_+3ZffjmA@mail.gmail.com>
Subject: Re: 1.7.25: problem with the cd command in ksh
From: Robert Klemme <shortcutter AT googlemail DOT com>
To: francis DOT andre DOT kampbell AT orange DOT fr, cygwin AT cygwin DOT com
X-IsSubscribed: yes

On Sat, Oct 5, 2013 at 8:33 AM, Francis ANDRE
<francis DOT andre DOT kampbell AT orange DOT fr> wrote:
> Hi Cygwin List
>
> I have a problem with the cd command in a ksh script. In the log below,
> there is this error:
> /make/scripts/webrev.ksh[2899]: cd:
> /cygdrive/z/DEV/OpenJDK_7u40/hotspot/Z:/DEV/OpenJDK_7u40/hotspo
> t/make/windows/makefiles: No such file or directory
>
> and the snippet producing this error is
>
>     # cd to the directory so the names are short
>     echo "=============================1" CWW=$CWS  DIR=$DIR
>     VARRR=$CWS/$DIR
>     echo "=============================2" VARR=$VARRR
>     cd "$VARRR"
>     echo "=============================3" $CWS/$DIR
>
> So it seems that the cd command is prepending the target directory where to
> go(Z:/DEV/OpenJDK_7u40/hotspo
> t/make/windows/makefiles)  by the current working directory
> (/cygdrive/z/DEV/OpenJDK_7u40/hotspot/)...

I guess that's because Z:/... is a relative path on Unix (as opposed
to Windows).

> Is there a way to avoid this prefix so that the commad: cd
> Z:/DEV/OpenJDK_7u40/hotspot/make/windows/makefiles just prepend by the
> cygdrive prefix?

Use a proper cygwin path, e.g.

/cygdrive/z/DEV/OpenJDK_7u40/hotspot/make/windows/makefiles

I typically do it like this: only use Unix style paths in scripts.  If
I invoke a Windows command I convert necessary paths with "cygpath -a
{path}".  I even have a script somewhere which looks at command line
arguments and converts them on the fly if it thinks it's a path (the
heuristic I use is that I test the path for existence and if that
fails I use dirname of the path and test it for existing directory).

Kind regards

robert


-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

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

- Raw text -


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