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

Free Servers & Workstations

Download Windows & Linux apps

  • 1
    Open-source tool to access Amazon S3
    file storage. S3cmd is a free command
    line tool and client for uploading,
    retrieving and managing data in Amazon
    S3 and ot...
    Download s3cmd
  • 2
    XyZerKunG ServerTool
    XyZerKunG ServerTool
    XyZerKunG ServerTool helps you to make
    your own Minecraft server and play with
    your friend for a few minutes.
    Features:Automatically create a
    Minecraft serverU...
    Download XyZerKunG ServerTool
  • 3
    Java source intended to serve as a
    nexus for teaching both mathematics and
    software solutions for computation on
    iterative equations. Public interfaces
    allow a...
    Download CalcTools
  • 4
    Rocket.Chat Desktop Client
    Rocket.Chat Desktop Client
    Rocket.Chat Desktop client is the
    official desktop app for Rocket.Chat,
    the simple but powerful open source web
    chat platform. It's tested on macOS,
    Download Rocket.Chat Desktop Client
  • 5
    OfficeFloor provides inversion of
    coupling control, with its: - dependency
    injection - continuation injection -
    thread injection For more information
    visit the...
    Download OfficeFloor
  • 6
    DivKit is an open source Server-Driven
    UI (SDUI) framework. It allows you to
    roll out server-sourced updates to
    different app versions. Also, it can be
    used fo...
    Download DivKit
  • More »

Linux commands