Cygwin – How to Convert Windows Path to Unix and Change Directory

cygwin;

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.

Best Answer

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.

Related Question