OnWorks favicon

lksh - Online in the Cloud

Run lksh in OnWorks free hosting provider over Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

This is the command lksh that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator



lksh — Legacy Korn shell built on mksh


lksh [-+abCefhiklmnprUuvXx] [-+o opt] [-c string | -s | file [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.


lksh currently has the following differences from mksh:

· There is no explicit support for interactive use, nor any command line editing or
history code. Hence, lksh is not suitable as a user's login shell, either; use mksh

· The KSH_VERSION string identifies lksh as “LEGACY KSH” instead of “MIRBSD KSH”. Note
that the rest of the version string is identical between the two shell flavours, and the
behaviour and differences can change between versions; see the accompanying manual page
mksh(1) for the versions this document applies to.

· lksh uses POSIX arithmetics, which has quite a few implications: The data type for
arithmetics is the host ISO C long data type. Signed integer wraparound is Undefined
Behaviour; this means that...

$ echo $((2147483647 + 1))

... is permitted to, e.g. delete all files on your system (the figure differs for
non-32-bit systems, the rule doesn't). The sign of the result of a modulo operation
with at least one negative operand is unspecified. Shift operations on negative numbers
are unspecified. Division of the largest negative number by -1 is Undefined Behaviour.
The compiler is permitted to delete all data and crash the system if Undefined Behaviour
occurs (see above for an example).

· lksh only offers the traditional ten file descriptors to scripts.

· The rotation arithmetic operators are not available.

· The shift arithmetic operators take all bits of the second operand into account; if they
exceed permitted precision, the result is unspecified.

· The GNU bash extension &> to redirect stdout and stderr in one go is not parsed.

· The mksh command line option -T is not available.

· Unless set -o posix is active, 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.

· Unlike AT&T UNIX ksh, mksh in -o posix or -o sh mode and lksh do not keep file
descriptors > 2 private from sub-processes.

· Functions defined with the function reserved word share the shell options (set -o)
instead of locally scoping them.

Use lksh online using onworks.net services