1.7.25: problem with the cd command in ksh
Francis ANDRE
francis.andre@easynet.fr
Sun Oct 6 08:49:00 GMT 2013
Hi Robert
The problem here is that the string of the target directory is computed by
another tool -- Mercurial in this case -- and that Mercurial returns a absolute
windows style path as
Z:/DEV/OpenJDK_7u40/hotspot
which seems to be relative in Unix world but which is absolute in the Windows
world.
Moreover, when using the bash shell, the command
FrancisANDRE@idefix /cygdrive/c/Cygwin
$ cd Z:/DEV/OpenJDK_7u40/hotspot
moves the cwd without error to
FrancisANDRE@idefix /cygdrive/z/DEV/OpenJDK_7u40/hotspot
So why the ksh cannot do the same?
Francis
Le 05/10/2013 12:22, Robert Klemme a écrit :
> On Sat, Oct 5, 2013 at 8:33 AM, Francis ANDRE
> <francis.andre.kampbell@orange.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
>
>
--
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
More information about the Cygwin
mailing list