We have hundreds of shell scripts running on a Solaris 11.3 server. System shell is ksh93

$ ls -l /bin/sh
lrwxrwxrwx   1 root     root          13 Apr 12  2018 /bin/sh -> sparcv9/ksh93

All the scripts have the she-bang #!/bin/ksh at the top.

The server is being migrated to Red Hat Enterprise Linux running on x86/64, and I understand the system shell is bash and ksh93 is not configured on RHEL by default.

I am assuming it is possible to install and configure ksh93 on RHEL to help with this?

Some of the scripts use ksh specific syntax.

Does anyone have any experience with this process?


1 Answer 1


Your (internal) RedHat system administrators will be able to do this for you. It's a trivial operation, something like this

yum install ksh

The system default shell and the shell used to run your scripts does not have to be the same. The shebang line tells your system which interpreter (which shell) to use to run a given script.

Bear in mind, though, that just because you have ksh installed your scripts may still not work. Depending on what they do and how they do it, they may require additional tools to be installed or you may even need to completely rewrite them to use different tools.

If your organisation has no experience with RH yet then I would ask why you're starting an application migration to it so soon. None of the Linux-based distributions are really drop-in replacements for Solaris.

There was a follow-up question in the comments asking about the use of #!/bin/sh on Solaris (where sh is symlinked to ksh93), and also asking what would happen for a script without a shebang.

In the first situation it depends how you run your scripts. Consider a script called action. If you run sh action (or sh /path/to/action) then you use the sh interpreter regardless of what is on the shebang line. For Solaris this is effectively ksh but on Linux-based systems it could be bash, ksh, or even dash. On the other hand, if your script is executable and in the $PATH, and you run it as action (or it's executable and you use /path/to/action), then the shebang line takes effect and /bin/ksh is used to execute the script.

As far as running a script without a #! instruction to define the interpreter, it depends entirely on the shell that you're using to call the script. Not recommended.

  • Unless something has changed, installing ksh on RHEL will get you ksh2020, not ksh93. Apr 28, 2021 at 22:52
  • @MarcWilson that's good to know. Are there any backwards incompatibilities between the two versions? Or any reason why (say) cd /bin && ln -s ksh2020 ksh93 would be a bad idea? Apr 28, 2021 at 23:13
  • Hm, maybe I'm incorrect and it's Fedora that adopted ksh2020, not RHEL8. If I look on a mirror, the RHEL8 ksh looks like ksh93. In any case, you certainly should not symlink the one to the other. If you want ksh93, you should install it. Apr 28, 2021 at 23:58
  • Oh I see, you are saying the correct package name is ksh93 rather then ksh? That's fine - we can fix the answer - I don't have RHEL so I guessed at ksh (hence the "something like" part). Thanks Apr 29, 2021 at 6:56

You must log in to answer this question.

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