Bash – How to get rid of Cygwin’s /cygdrive prefix in all paths

bashrccygwin;path

I'm switching to Cygwin from the bash shell that ships with Git for Windows, and encountering a strange problem. Someone thought it would be a good idea to add /cygdrive/ to all paths, while I think it's a horribly ugly idea. I've been able to determine that I can partially fix this by adding

mount --change-cygdrive-prefix /
export HOME=/c/Users/BZISAD0

in my .bashrc, but if I take a look at the PATH variable, everything still has /cygdrive/ in it. I suppose I could write a script to fix the PATH but that's even more kludgey than what I'm already doing. There's got to be a better way, and I'm pretty confident there is since Git's bash shell uses (AFAIK) an older version of Cygwin, and it's somehow configured to not prepend /cygdrive everywhere. So, how can I turn the "Suck" knob to zero?

Gary Larson comic

Best Answer

Grepping around in /etc turned up a link that Googling did not. It turns out you can control this in the file /etc/fstab. Just add a line that says

none / cygdrive binary 0 0

and the problem should be fixed. No more kludgey fixes in .bashrc, and no messed-up $PATH.

Related Question