Korn-Shell for Windows 7?

a 夏天 提交于 2019-12-03 09:13:19

Cygwin does support C:/path/to/app style paths, even though it likes to complain about them. (Setting CYGWIN=nodosfilewarning will shut it up). Even paths with backslashes are supported, but they need appropriate quoting to stop the shell from interpreting them.

Pdksh, the "Public Domain Korn Shell", can be installed through Cygwin's setup.exe.

mirabilos

Cygwin luckily replaced pdksh (dead since 1999) with mksh. However, mksh will *not* support non-POSIX paths, as it’s primarily a BSD Unix shell, and one of its strengths is working the same across all platforms.

That being said, there’s dos2unixpath and unix2dospath (IIRC) in Interix. Maybe you can use them.

Something like this might even work:

function dos2unixpath {
    local _x=$1
    [[ $_x = [A-Za-z]:[\\/]* ]] && _x=/dev/fs/${_x::1}/${_x:3}
    print -r -- "${_x//\\//}"
}

This converts x:\foo\bar to /dev/fs/x/foo/bar, ..\bla to ../bla, and leaves the rest alone.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!