В Windows SUA (Система для приложений Unix) я не могу заставить KSH запускать команды. Даже Ls не удается

1416
barlop

Мне удалось установить Windows SUA (подсистему для приложений Unix) в Windows 7 Ultimate. Я могу запускать команды c:\windows\sua\commonпрямо из cmd.exe, но я хочу попробовать запускать команды из оболочки korn. Я вижу ksh в меню «Пуск», если я ввожу ksh в поле поиска. Но я получаю ошибку, когда пытаюсь запустить команды оттуда.

Я вижу, нажимаю ли я кнопку "Пуск" и набираю ksh, тогда я вижу файл ksh.bat, находящийся в каталоге c: \ windows \ SUA \ common \ ksh.bat

Когда я запускаю ksh.bat, а затем делаю echo $PATH

Я вижу каталоги, в том числе /dev/fs/C/Windows/SUA/common:/dev/fs/C/Windows/SUA/usr/lib

И для записи у меня ls.exeздесь

C:\Windows\SUA\common>dir ls.exe<ENTER> 01/18/2008 05:40 AM 174,592 ls.exe 

Но когда я запускаю ksh.bat, то я пытаюсь запустить ls, он говорит

$ ls /bin/ksh: ls: not found $ cd $ $ 
0
Этот вопрос все еще актуален, так как вы выяснили, что происходит в другом? Ramhound 9 лет назад 0
@ Ramhound да, это очень актуально barlop 9 лет назад 0

1 ответ на вопрос

0
barlop

I see now in the start menu there is an entry "Subsystem for UNIX-based Applications" but oddly it didn't come up with orange highlight (which new entries normally do), so I didn't notice it. Here it is expanded.

enter image description here

Choosing Korn Shell from there, opens it up. It runs the line C:\Windows\posix.exe /u /c /bin/ksh -l

And then ls works

Whereas running ksh.bat alone, doesn't work.

The difference between that command line, and ksh.bat

Is ksh.bat does posix /u /c /bin/ksh %1 %2 %3 %4 %5 %6 %7 %8 %9 which if you run ksh.bat with no parameters, it equates to posix /u /c /bin/ksh i.e. no -l (i.e. no dash el)

Whereas the korn shortcut, does the same line but with -l.

If you run ksh -l then that would be running ksh.bat with -l and as c:\windows\posix.exe is covered in the path, looking at the command line used by ksh.bat, it is(when with -l) then the same as what the shortcut does, and thus works just as the shortcut works.

So, either run from the shortcut, or run the bat file with ksh -l

Prior related question Where are the EXEs for Subsystem For Unix Applications so I can use it?

Похожие вопросы