How to uniformly point to the root of a drive?

Brian Dessent
Sun May 20 16:23:00 GMT 2007

Dave Korn wrote:

>   This relies on the mountpoints being set correctly, which might not work if
> your drive letter changes ...

Well if that is the case and / points to the wrong dir then I don't see
how you can be using Cygwin at all, so many things will be broken.  To
get the POSIX path of the rootdir of the drive correponding to the CWD,
then you can use something like:

whatever="$(mount -p | tail -n1 | cut -f1 -d' ')$(cmd.exe /c "cd" \
          | cut -b1 | tr 'A-Z' 'a-z')"

But I don't see how this is useful in the least, since by definition if
the mount table does not refelect reality then using POSIX paths for any
purpose is unreliable at best and a waste of time at worst, so finding
the POSIX path corresponding to the rootdir seems pointless.  If you
want to update the mount table you need the win32 path, not the POSIX
path, and if the mount table has already been updated then this is much


Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list