Windows PATH to posix path conversion in bash

前端 未结 6 1550
北荒
北荒 2020-12-04 16:35

How can I convert a Windows dir path (say c:/libs/Qt-static) to the correct POSIX dir path (/c/libs/Qt-static) by

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-04 17:12

    Are you using it on cygwin? If yes, then there is a readymade utility called cygpath.exe in cygwin package just for doing that.

    Output type options:
      -d, --dos             print DOS (short) form of NAMEs (C:\PROGRA~1\)
      -m, --mixed           like --windows, but with regular slashes (C:/WINNT)
      -M, --mode            report on mode of file (binmode or textmode)
      -u, --unix            (default) print Unix form of NAMEs (/cygdrive/c/winnt)
      -w, --windows         print Windows form of NAMEs (C:\WINNT)
      -t, --type TYPE       print TYPE form: 'dos', 'mixed', 'unix', or 'windows'
    

提交回复
热议问题