MirBSD Korn Shell R59c

The MirBSD Korn Shell (mksh) is an actively developed successor of pdksh (the Public Domain Korn Shell), aimed at producing a shell good for interactive use, but with the primary focus on scripting. It is intended to be portable to most *nix-like operating systems as long as they're not too obscure. mksh incorporates improvements from OpenBSD and Debian, as well as bugfixes and enhancements developed for the MirOS, FreeWRT, and MidnightBSD projects and Android. The emacs command line editing mode is UTF-8 capable, and Byte Order Marks are ignored in scripts. The shell supports large files, as well as all pdksh and some csh, AT&T ksh, zsh, and GNU bash features, is compatible with the Bourne shell and POSIX (within limits), has no limit on array sizes, and incorporates some other useful builtins and features. While being already fast and small (without losing functionality), flags to make it even smaller can be given at compile time. An interactive shell reads "~/.mkshrc" on startup.

Tags shell korn-shell ksh
License MirOS
State stable

Recent Releases

R59c03 Nov 2020 00:48 major bugfix: Update character widths (Jamo bugfix). Don t use test -e in Build.sh. Mac OSX-specific: ensure ulimit -m is present even if it is an alias of ulimit -v (10.4+), for compatibility. Port to A/UX. Add older ulimit(2) support, if setrlimit(2) is missing. More EBCDIC-safeness (slightly ). Allow all tests to pass with very old Perl 5. Fix test.sh s output of tested/expected shell version. Let A/UX default CC to gcc. Drop is being ported warning from A/UX and OS/2, they work. Include only if MKSH_NOPWNAM is not defined. command -v must print absolute pathnames, even if PATH contains relative pathnames under which the command in question was found (orbea). Fix absolute pathnames relative to / on nōn-OS/2, too. Fix some more corner cases related to pathname normalisation. FAQ: @? : bad substitution documentation. Fix some constructs pointed out by https://www.deepcode.ai/. Clean, refactor, optimise some code. Allow Xe on empty command line; quote editor argument properly. FAQ: an IRC user suggests Xe for ad-hōc scripts and multiline. Eliminate many unnecessary calls to (re )allocate memory. Correct order during tree-printing of heredocs. Drop some possibly unreached and probably broken code. Increase FAQ2HTML.sh compatibility with pre-POSIX shells. Demote some (unlikely called) output code to !MKSH_SMALL.
R50f19 Apr 2015 22:50 security: Add a patch marker for vendor patch versioning to mksh.1. SECURITY: make unset HISTFILE actually work. Document some more issues with the current history code. Remove some unused code. RCSID-only sync with OpenBSD, for bogus and irrelevant changes. Also disable field splitting for alias 'local= typeset'. Fix read -n-1 to not be identical to read -N-1. Several fixes and improvements to lksh(1) and mksh(1) manpages. More code (int size_t), comment and testsuite fixes. Make dot.mkshrc more robust (LP#1441853). Fix issues with IFS=' ' read, found by edualbus. Fix integer overflows related to file descriptor parsing, found by Pawel Wylecial (LP#1440685); reduce memory usage for I/O redirs. Document in the manpage how to set U according to the current locale settings via LANG/LC_* parameters (cf. Debian #782225). Some code cleanup and restructuring. Handle number parsing and storing more carefully.
R50e28 Mar 2015 18:00 minor bugfix: Add more tests detailing behaviour difference from GNU bash. Introduce a memory leak for x=
R50d23 Oct 2014 21:02 major bugfix: Fix NULL pointer dereference on unset x; nameref x . Fix severe regression in field splitting. Add a warning about not using tainted user input (including from the environ(7)ment) in arithmetics.
R50c03 Oct 2014 19:55 security: Know more rare signals when generating sys_signame replacement. OpenBSD sync (mostly RCSID only). Document HISTSIZE limit; found by luigi_345 on IRC. Fix link to Debian .mkshrc. Cease exporting RANDOM (Debian #760857). Fix C99 compatibility. Work around klibc bug causing a coredump (Debian #763842). Use issetugid(2) as additional check if we are FPRIVILEGED. SECURITY: do not permit += from environment. Fix more field splitting bugs reported by Stephane Chazelas and mikeserv; document current status wrt. ambiguous ones as testcases too.
R50b10 Sep 2014 23:00 minor bugfix: Fix operator description in the manpage. Change all mention of eglibc to glibc , it is merged back. Fix rare infinite loop with invalid UTF-8 in the edit buffer. Make more clear when a shell is interactive in the manpage. Document that is a symmetric remainder operation, and how to get a mathematical modulus from it, in the manpage. Make the cat(1) builtin also interruptible in the write loop, not just in the read loop, and avoid it getting SIGPIPE in the smores function in dot.mkshrc by terminating cat upon user quit. Make some comments match the code, after jaredy from obsd changed IFS split handling. Fix some IFS-related mistakes in the manual page. Document another issue as known-to-fail test IFS-subst-3. Improve check.pl output in some cases. Relax overzealous nameref RHS checks.
R5003 Jul 2014 19:14 minor feature: Fix initial IFS whitespace not being ignored when expanding, MKSH_BINSHREDUCED no longer mistakenly enables brace expansion, explain more clearly Vi input mode limitations in the manpage, improve error reporting of the check.pl script, use TMPDIR in test.sh for scratch space, check that the scratch space is not mounted noexec, use termcap(5) names, not terminfo(5) names, in tput(1) examples, for improved portability (e.g. to MidnightBSD), avoid C99 Undefined Behaviour in mirtoconf LFS test, fix !foo for when foo is unset, improve nameref error checking, fix readonly bypass, improved system reporting for Mac OS X, explain better extglob handling in the manpage, remove arr=( index =value) syntax due to regressions, IFS-split arithmetic expansions as per POSIX 201x, add more detailed Authors section to manpage, fix set p issue for good: drop privs unless requested, improve signal handling and use a more canonical probing order, fix return values ? and PIPESTATUS * interaction with set -o pipefail and COMSUBs, detect ENOEXEC ELF files and use a less confusing error message, update to Unicode 7.0.0, shut up valgrind in the RANDOM code, use -fstack-protector-strong in favour of -fstack-protector-all, fix access-after-free crash