pdksh

A free alternative to bash is a version of the Korn shell known as pdksh (standing for Public Domain Korn shell). pdksh is available as source code in various places on the Internet, including the USENET newsgroup comp.sources.unix, and the pdksh World Wide Web home page (http://www.cs.mun.ca/~michael/pdksh/) of the current maintainer, Michael Rendell.

pdksh was originally written by Eric Gisin, who based it on Charles Forsyth’s public domain Version 7 Bourne shell. It has all Bourne shell features plus some of the POSIX extensions and a few features of its own.

pdksh’s additional features include user-definable tilde notation, in which you can set up ~ as an abbreviation for anything, not just usernames.

Otherwise, pdksh lacks a few features of the official Korn version and bash. In particular, it lacks the following bash features:

  • The built-in variable PS4

  • The advanced I/O redirectors >| and <>

  • The options errexit, noclobber, and privileged

One important advantage that pdksh has over bash is that the executable is only about a third the size and it runs considerably faster. Weighed against this is that it is less POSIX-compliant, has had numerous people add code to it (so it hasn’t been as strongly controlled as bash), and isn’t as polished a product as bash (for example, the documentation isn’t anywhere near as detailed or complete).

However, pdksh is a worthwhile alternative for those who want something other than bash and can’t obtain the Korn shell.

Get Learning the bash Shell, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.