I rarely touch shell scripts, we have another department who write them, so I have an understanding of writing them but no experience. However they all appear rather useless with my issue.
I am trying to execute some KornShell (ksh) scripts on a windows based machine using Cygwin- we use these to launch our Oracle WebLogic servers, now it simply will not execute. I used to be able to execute these exact same scripts fine on my old machine.
Now I have narrowed this down to the fact the 'magic number' or whatever it is at the start of the script where it specifies the script interpreter path:
i.e.:
#!/bin/ksh
if I change it to execute as a simple bash it works i.e:
#!/bin/sh
I went through checking the packages installed for cygwin - now the shells I installed are:
- mksh MirdBSD KornShell
- bash the bourne again shell
- zsh z shell
Should I expect to see a ksh.exe in my cygwin/bin directory? there is a system file 'ksh' which I was making an assume somehow associates it with one of the other shell exes, like mksh.exe
I understand my explanation may well be naff. But that being said, any help would be very much appreciated.
Thanks.
14 Answers
I believe the MirBSD korn shell is called mksh. You can verify this and look for the correct path by typing
% which mksh % which ksh or if you have no which,
% type -p mksh % type -p ksh or if that fails too, check /etc/shells which should list all valid shells on a system:
% grep ksh /etc/shells You need to put the full path after the #! line. It will probably be /bin/mksh, so your line needs to look like:
#!/bin/mksh 1You've probably fixed it by now, but the answer was no, your Cygwin does not (yet) know about ksh.
I solved this problem by launching the cygwin setup in command-line mode with the -P ksh attribute (as described in ).
You can run a ksh using a bat file
C:\cygwin\bin\dos2unix kshfilename.ksh
C:\cygwin\bin\bash kshfilename.ksh
Running a shell script through Cygwin on Windows
Install KornShell (ksh) into Cygwin by the following process:
- Download: ksh.2012-08-06.cygwin.i386.gz
- Install ksh via Cygwin setup.
- Execture Cygwin setup.exe
- Choose: Install from Local Directory
- Select the ksh.2012-08-06.cygwin.i386.gz as the Local Package Directory.

- Complete Cygwin setup.
- Restart Cygwin.