I'm not a system administrator, but my organization is considering replacing /bin/sh in Red Hat Enterprise Linux 6+ with a hard link to /bin/ksh. How foolhardy would this be?
The background to this question is that we're migrating a third-party application from AIX 5.3 to RHEL 6+. This application executes shell commands by invoking sh. The shell commands themselves are user-defined, and in practice have been written for the Korn shell (ksh). This works in AIX because IBM delivers sh as a hard link to ksh. Over the years, thousands of user-defined commands have been created and stored by our team.
We've found that some of these commands fail in Red Hat, because sh in Redhat is a symbolic link to bash. When invoked as sh, bash runs in sh emulation mode. The problem is that our ksh-specific commands (e.g., print) that used to work in "fake sh" in AIX do not work in "fake sh" in Red Hat. We don't yet know the full scope of the incompatibilities.
In chapter 10 of Learning the Korn Shell (ISBN 0-596-00195-9), Bill Rosenblatt and Arnold Robbins say: "[W]e want to emphasize something about the Korn shell that doesn't apply to most other shells: you can install it as if it were the standard Bourne shell, i.e., as /bin/sh." ... "Many installations have done this with absolutely no ill effects."
How foolhardy would it be to do this in Red Hat? My concern is that system or 3rd party scripts in the Red Hat installation might depend on idiosyncracies of how sh is emulated by bash. If so, solving our immediate problem with a hard link to ksh could cause unknown breakage throughout the system.
/bin/sh
as/bin/ksh
/bin/sh
to/bin/ksh
? That way you're compatible with everyone - the old users who are used to usingksh
-specific features, and new ones who might want to write forsh
-specificity.