Cygwin convert windows path to unix then change dir

I am usually trying to use the cygwin terminal to move to a nested directory. The problem is the windows directory are not immediately interpreted.

So I had to do two step:

$ cygpath -u "C:\Develop\blah\blah\blah\too_deep\"
/cygdrive/c/Develop/blah/blah/blah/too_deep/
$ cd /cygdrive/c/Develop/blah/blah/blah/too_deep/

I need to convert the path first then paste the result to change it.

I tried to use redirect but it does not work. Any ideas?

$ cygpath -u "C:\Develop\blah\blah\blah\too_deep\" | cd

=> No results.


Try this:

cd $(cygpath -u 'C:\Develop\blah\blah\blah\too_deep\')

The $(command) construct does a command substitution and is replaced with the output of the command.


You'll need to enclose it in double quotes if the path contains spaces:

cd "$(cygpath -u 'c:\Program Files\')"