What is UNIX / Linux Korn Shell?

What is UNIX / Linux Korn Shell?

Korn Shell is developed by David Korn at Bell Laboratories

It is upwardly compatible with most Bourne shell features.

It has interactive features like C Shell, but executes faster and has extended inline command editing capability.

The ksh93 version supports associative arrays and built-in floating point arithmetic.

Korn Shell Features

  1. Command history – Yes
  2. Line editing – Yes
  3. File name completion – Yes
  4. Alias command – Yes
  5. Restricted shells – Yes
  6. Job control – Yes

#!/usr/bin/ksh

All shell scripts for the KSH shell start with the first line:

#!/usr/bin/ksh

This is called a shebang, a hashbang, hashpling, or pound bang. The following is a KSH shell script file example:

#!/usr/bin/ksh
echo "Hello World!"

You can find ksh path using which command:
$ which ksh
Sample Output:

/usr/bin/ksh

Shebangs specify absolute paths to system executables; this can cause problems on systems which have non-standard file system layouts. Even when systems have fairly standard paths, it is quite possible for variants of the same operating system to have different locations for the desired interpreter. This can be fixed by making a script portable with #!/usr/bin/env as a shebang:

#!/usr/bin/env ksh
echo "Hello World!"

Did you find this article useful?