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