Korn Shell

The KornShell is a reimplementation of the Bourne shell. It is downward compatible, but adds many features intended to simplify programming. Most of the features are part of POSIX shell, too, and therefore are available on any POSIX compliant system.

Bash also implements most of the Korn shell's functionality.

There are three primary version of the Korn shell in use today: the original (often dubbed ksh88), the successor (ksh93), and an open source version called pdksh ("Public Domain Korn Shell"). pdksh was developed before the source code for ksh93 was liberated.

The Korn shell (either ksh88 or ksh93, depending on the age of the system) is a standard part of any modern (commercial) Unix system, e.g. Solaris, AIX, HP-UX. pdksh is often available on BSD or GNU/Linux systems, and a growing number of GNU/Linux systems now offer ksh93, either instead of or in addition to pdksh.

Some of the features of the Korn shell are:

        # ksh93
        for ((i=0; i<10; ++i)); do
            print $i
        done

        parent=`basename \`dirname "${PWD}"\``

        parent=$(basename $(dirname "${PWD}"))

        case ${url} in
            http://*) print a browser can handle that;;
                   *) print maybe a browser can handle that, too;;
        esac

        if [[ ${pathname} == /* ]]; then
            print path is absolute;
        fi

Other, smaller improvements over the BourneShell include

Most of the features of the KornShell are available in the BashShell, too. The following features are not found in the BashShell:

And everyone's favorite KornShell feature that's not in Bash:


CategoryShell