• Stars
    star
    305
  • Rank 136,879 (Top 3 %)
  • Language
    C
  • Created almost 10 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Portable OpenBSD ksh, based on the Public Domain Korn Shell (pdksh).

oksh

Portable OpenBSD ksh(1). Not an official OpenBSD project.

Why?

Because all operating systems deserve a good shell.

Unlike other ports of OpenBSD ksh, this port is entirely self-contained and aims to be maximally portable across operating systems and C compilers. We are always looking for new combinations to add support for.

Supported systems

oksh is known to run on the following Operating Systems:

  • OpenBSD
  • FreeBSD
  • DragonFly BSD
  • NetBSD
  • HardenedBSD
  • SoloBSD (as the default shell)
  • Mac OS X (port originally by @geoff-nixon)
  • Linux (glibc and musl)
  • Cygwin
  • Android (via Termux)
  • AIX (with major thanks to @tssva and @NattyNarwhal)
  • IBM i PASE
  • Solaris
  • Illumos
  • midipix
  • WSL
  • WSL2
  • Unixware 7
  • Haiku
  • HP-UX (gcc only)
  • SerenityOS
  • MSYS2

Running on a system not listed here? Add it and send a pull request!

Believed working

We believe that oksh will work on the following platforms, but testing is needed. Help is greatly appreciated and encouraged!

  • Irix

Supported compilers

oksh is known to build with the following C compilers:

Building with a compiler not listed here? Add it and send a pull request!

Packages

oksh is included in some package systems.

Packaging status

In addition, there are some unofficial packages:

Using a package not listed here? Add it and send a pull request!

Dependencies

A C99 compiler is the easiest way to ensure that oksh will build correctly. Please see the list of C compilers above for a list of known working compilers.

Though not required, the ncurses library will be used for screen clearing routines if the library is found during the configure stage. This can be turned off by the user by passing the --disable-curses flag to configure.

A configure script that produces a POSIX Makefile is provided to ease building and installation and can be run by:

$ ./configure
$ make && sudo make install

Out-of-tree builds

The configure script will detect out-of-tree builds if you prefer to build out-of-tree. In order for this to work, the VPATH make extension is used. While not POSIX, VPATH is known to work with BSD make and GNU make. In-tree builds create a fully POSIX Makefile.

Cross compiling

Cross compiling can be achieved by running configure as follows:

CC=/path/to/cross/cc CFLAGS="any needed cflags" LDFLAGS="any needed ldflags" ./configure --no-thanks

This will skip all configure checks and write out a generic Makefile and pconfig.h with nearly no options turned on. If using a cross gcc or clang, this very well may just work (with all compat compiled in). You can edit these files to reflect your system before running make.

All environment variables and configure flags are respected when using --no-thanks. Further specifying --no-link after --no-thanks will only compile the source files into object files, to be transfered onto the target machine and linked there.

The --no-thanks flag can also be used to compile a native oksh with all the compatibility functions compiled in, rather than relying on the system's version of those functions.

Submitting patches

Patches that add new platforms and improve support for existing platforms are always welcome.

Patches that cause oksh to deviate from upstream OpenBSD ksh behavior are better suited to be sent to the OpenBSD tech@ mailing list. Please make sure to test your patch on an OpenBSD machine first before submitting it to tech@. I will sync with the upstream OpenBSD code once your patch is accepted. If you'd like to open an issue here to track progress of your patch on tech@, that's fine.

License

The main Korn shell files are public domain (see LEGAL). Portability files are BSD or ISC licensed; see individual file headers for details.

Get a tarball

See releases tab. The latest release is oksh-7.5, which matches the ksh(1) from OpenBSD 7.5, released April 5, 2024.

More Repositories

1

pl0c

Self-hosting PL/0 to C compiler to teach basic compiler construction from a practical, hands-on perspective.
C
135
star
2

mg

OpenBSD Mg editor. Portable Public Domain Micro Emacs for *BSD, Cygwin, Linux, Mac OS X.
C
115
star
3

8088ify

The famous Intel 8080 CP/M 2.2 to Intel 8086/8088 MS-DOS assembly language translator.
C
86
star
4

oed

Portable OpenBSD ed(1) editor.
C
38
star
5

l80

CP/M and MS-DOS COM executable linker written in D.
D
38
star
6

cpaint

https://briancallahan.net/blog/20220220.html
C
30
star
7

sprite

ncurses-based sprite editor
C
27
star
8

a80

Intel 8080/Zilog Z80 assembler written in D.
D
27
star
9

snakeqr

Game of snake that fits in a QR code.
C
26
star
10

baseutils

Portable OpenBSD userland utilities
C
25
star
11

bf256

Brainfuck compiler under 256 bytes in size.
Assembly
25
star
12

O

Peephole optimizer for cproc and QBE
C
22
star
13

yacc

Portable OpenBSD Yacc.
C
21
star
14

echo

Learn how argc and argv are passed from environment to Unix program.
Assembly
18
star
15

m4

Portable OpenBSD m4.
C
17
star
16

make

Portable OpenBSD Make.
C
17
star
17

bf.ssa

Brainfuck compiler written in QBE IR.
Makefile
15
star
18

LiteBSD-Ports

The LiteBSD ports tree.
C
15
star
19

d80

Intel 8080/Zilog Z80 disassembler written in D.
D
15
star
20

planck

The world's worst text editor, if it can even be considered a text editor.
C
15
star
21

libpuffy

Library to ease porting userland OpenBSD code to Serenity
C
12
star
22

openbsd-ports-wip

Work-in-progress ports for OpenBSD
Makefile
12
star
23

shuf

ISC licensed reimplementation of GNU shuf.
C
12
star
24

i80

Intel 8080 emulator with built-in CP/M emulation
C
11
star
25

easyconfig

Configuration for the rest of us.
C
10
star
26

bfc

Compile Brainfuck to multi-platform assembly.
C
9
star
27

edx

Small Wordstar-like text editor for X11.
C
8
star
28

vce

Visual Code Editor
C
7
star
29

mgksh

OpenBSD ksh(1) and mg(1) in a single static binary!
C
7
star
30

qbe

Mirror of https://c9x.me/git/qbe.git
C
7
star
31

ar80

CP/M and MS-DOS library archiver utility written in D.
D
6
star
32

getexecname

Get the pathname of a running executable on OpenBSD.
C
6
star
33

cowgol-utilities

Quick utilities in Cowgol to try out the language.
Makefile
6
star
34

dqoi

Tiny X11 image viewer for QOI images.
C
6
star
35

ash

Port of NetBSD sh(1) to OpenBSD.
C
6
star
36

ocsh

Portable OpenBSD csh.
C
6
star
37

sysctlbyname

sysctlbyname(3) compat library for OpenBSD
C
6
star
38

coin

Command interpreter for Unix, for learning how shells issue commands.
C
5
star
39

libterminfo

Port of NetBSD libterminfo for other POSIX systems.
C
5
star
40

ogzip

Portable OpenBSD gzip utility
C
5
star
41

nbc

Portable NetBSD bc(1) calculator.
C
5
star
42

gmake-d

GNU Make with built-in D support.
C
5
star
43

otar

Portable OpenBSD tar and pax
C
5
star
44

eva

simple Wirthian programming language
D
4
star
45

cat

Learn simple reading and writing of Unix files.
Assembly
4
star
46

dotfiles

I guess this makes me cool. I've uploaded my dotfiles.
Shell
4
star
47

kodachrome

Screenshot utility written in D.
D
3
star
48

OpenRCS

Portable OpenBSD OpenRCS.
C
3
star
49

hex

Simple hex viewer
C
3
star
50

repology

Command line interface for Repology.org
D
3
star
51

tac

concatenate and print files in reverse
C
3
star
52

dmake

Illumos make ported to OpenBSD
C++
3
star
53

bin2hex

Convert binary files to Intel HEX format
C
2
star
54

libwordexp

Port of NetBSD wordexp(3) to OpenBSD.
C
2
star
55

libOpenBSD

ITWS 4370 Information Systems Security helper library.
C
2
star
56

cmb

OpenBSD port of FreeBSD combinatorics library/utility
C
2
star
57

c99

POSIX c99(1) utility for OpenBSD
Roff
2
star
58

sndio

D bindings for sndio.
D
1
star
59

misc

Miscellaneous bits of work.
1
star
60

icb

Small ICB Client
C
1
star
61

scores

C
1
star
62

ports

A place to hold miscellaneous OpenBSD ports distfiles.
1
star
63

stdcow

A standard library for Cowgol.
1
star
64

hexd

Simple hexdump utility written in D.
D
1
star
65

polyglot-cat

The Unix cat utility in many different languages. A teaching exercise.
F#
1
star
66

tic80-openbsd

Distfiles for TIC-80 package on OpenBSD
1
star
67

gravity-mode

Emacs Major mode for the Gravity programming language.
Emacs Lisp
1
star
68

wmapmload

Window Maker power/battery monitor (OpenBSD fork)
C
1
star
69

pledged

OpenBSD pledge(2) and unveil(2) bindings for D. (Deprecated)
D
1
star
70

sunmake

Port of SunPro Make to OpenBSD
C++
1
star