0

I have managed to install Windows SUA(Subsystem for Unix Applications), in Windows 7 Ultimate. I can run the commands in c:\windows\sua\common straight from cmd.exe but I want to try running commands from the korn shell. I see ksh in the start menu if I type in ksh into the search box. But I get an error when I try to run commands from there.

I see if I click start and type ksh, then I see ksh.bat which is in c:\windows\SUA\common\ksh.bat

When I run ksh.bat and then do echo $PATH

I see directories including /dev/fs/C/Windows/SUA/common:/dev/fs/C/Windows/SUA/usr/lib

And for the record I have ls.exe here

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

But when I run ksh.bat then I try to run ls, it says

$ ls
/bin/ksh: ls: not found
$ cd
$
$
2
  • This question still relevant since you figured out what was going in the other one?
    – Ramhound
    Commented Nov 18, 2014 at 15:31
  • @Ramhound yes it's very relevant
    – barlop
    Commented Nov 18, 2014 at 15:39

1 Answer 1

0

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?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .