Scroll to navigation

LKSH(1) General Commands Manual LKSH(1)

NAME

lkshLegacy Korn shell built on mksh

SYNOPSIS

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

DESCRIPTION

lksh is a command interpreter intended exclusive for running legacy shell scripts. It is built on mksh; refer to its manual page for details on the scripting language.

LEGACY MODE

lksh has the following differences from mksh:
  • lksh is not suitable for use as /bin/sh.
  • There is no explicit support for interactive use, nor any command line editing code. Hence, lksh is not suitable as a user's login shell, either; use mksh instead.
  • The KSH_VERSION string identifies lksh as “LEGACY KSH” instead of “MIRBSD KSH”.
  • Some mksh specific extensions are missing; specifically, the -T command-line option.
  • lksh always uses traditional mode for constructs like:
    $ set -- $(getopt ab:c "$@") 
    $ echo $?
        
    POSIX mandates this to show 0, but traditional mode passes through the errorlevel from the getopt(1) command.
  • lksh, unlike AT&T UNIX ksh, does not keep file descriptors > 2 private.
  • lksh parses leading-zero numbers as octal (base 8).
  • Integers use the host C environment's long type, not int32_t. Unsigned arithmetic is done using unsigned long, not uint32_t. Neither value limits nor wraparound is guaranteed. Dividing the largest negative number by -1 is Undefined Behaviour (but might work on 32-bit and 64-bit long types).
  • lksh only offers the traditional ten file descriptors to scripts.

SEE ALSO

mksh(1)
https://www.mirbsd.org/mksh.htm
https://www.mirbsd.org/ksh-chan.htm

CAVEATS

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. Parsing numbers with leading zero digits or “0x” is relatively recent in all pdksh derivates, but supported here for completeness. It might make sense to make this a run-time option, but that might also be overkill.
The set built-in command does not have all options one would expect from a full-blown mksh or pdksh.
Talk to the MirOS development team using the mailing list at ⟨miros-mksh@mirbsd.org⟩ or the #!/bin/mksh (or #ksh) IRC channel at irc.freenode.net (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.
May 31, 2017 MirBSD