OpenBSD uses their own KornShell implementation (derived from the old public domain KornShell, pdksh) as the default shell, the codebase is much smaller than that of bash and benefits from the audits performed regularly by the developers. It uses less memory than bash and is also faster[1] but doesn't support here strings or numerical brace expansion; here documents & standard brace expansion work fine though.bash(1) wrote:BUGS
It's too big and too slow.
There are two Linux ports of this program available:
https://github.com/ibara/oksh
https://github.com/dimkr/loksh
They both compile under Debian so I have packaged them up and added them to my OBS repository (the oksh package was ported by an OpenBSD developer and so should probably be favoured):
https://software.opensuse.org//download ... ckage=oksh
https://software.opensuse.org//download ... kage=loksh
To change the default interactive shell either run
Code: Select all
chsh -s /bin/oksh # or /bin/loksh
Code: Select all
# update-alternatives --set ksh /bin/oksh
chsh -s /bin/ksh
Code: Select all
export ENV="${HOME}/.kshrc"
Code: Select all
set -o emacs
Code: Select all
580.0 KiB + 96.5 KiB = 676.5 KiB ksh
2.4 MiB + 216.5 KiB = 2.6 MiB bash
Code: Select all
-rwxr-xr-x 1 root root 1.2M Jan 24 10:01 /bin/bash
-rwxr-xr-x 1 root root 264K Apr 9 19:13 /bin/ksh
Code: Select all
$ time for i in $(seq 1 1000000);do [ 1 = 1 ];done
0m01.96s real 0m01.90s user 0m00.09s system
Code: Select all
$ time for i in $(seq 1 1000000);do [ 1 = 1 ];done
real 0m3.633s
user 0m3.586s
sys 0m0.061s
Code: Select all
$ time for i in {1..1000000};do [ 1 = 1 ];done
real 0m3.944s
user 0m3.876s
sys 0m0.064s