lksh man page

lksh — Legacy Korn shell built on mksh


lksh [-+abCefhiklmnprUuvXx] [-+o opt] [-c string | -sfile [args ...]]


lksh is a command interpreter intended exclusively for running legacy shell scripts. It is built on mksh; refer to its manual page for details on the scripting language. It is recommended to port scripts to mksh instead of relying on legacy or idiotic POSIX-mandated behaviour, since the MirBSD Korn Shell scripting language is much more consistent.

Note that it's strongly recommended to invoke lksh with at least the -o posix option, if not both that and -o sh, to fully enjoy better compatibility to the POSIX standard (which is probably why you use lksh over mksh in the first place) or legacy scripts, respectively.

Legacy Mode

lksh currently has the following differences from mksh:

See Also



The distinction between the shell variants (lksh / mksh) and shell flags (-o posix / sh) will be reworked for an upcoming release.

To use lksh as /bin/sh, compilation to enable set -o posix by default if called as sh is highly recommended for better standards compliance. For better compatibility with legacy scripts, such as many Debian maintainer scripts, Upstart and SYSV init scripts, and other unfixed scripts, using the compile-time options for enabling both set -o posix -o sh when the shell is run as sh is recommended.

lksh tries to make a cross between a legacy bourne/posix compatibl-ish shell and a legacy pdksh-alike but “legacy” is not exactly specified.

The set built-in command does not currently have all options one would expect from a full-blown mksh or pdksh.

Talk to the MirOS development team using the mailing list at ⟨⟩ or the #!/bin/mksh (or #ksh) IRC channel at (Port 6697 SSL, 6667 unencrypted) if you need any further quirks or assistance, and consider migrating your legacy scripts to work with mksh instead of requiring lksh.

Referenced By


November 11 2016