Linux Reader
Access files and folders on Ext, UFS, HFS, ReiserFS, or APFS file systems from Windows

Pew Pew madafakas!

Access files and folders on Ext, UFS, HFS, ReiserFS, or APFS file systems from Windows
Last updated: Jul 29, 2021

What is Korn shell script?

Here you will find out:

  • what Korn shell is
  • what the difference between Korn shell and the traditional Bourne shell is
  • how to write a Korn shell script
  • when DiskInternals can help you

Are you ready? Let's read!

About Korn shell

Korn shell (ksh) has a character-based user interface, similar to all other shells you know. As you may know, a character-based interface allows a user to enter text (commands), and it also prints the output of the commands in text form. In contrast, Graphical User Interfaces (GUIs) can print graphics, as well as accept different kinds of inputs.

A shell is character-based and enables UNIX-like OSes to communicate with kernels and execute commands. There are different types of shells, and ksh is one of the most common. Ksh is also the default shell for AIX systems.

The difference between Korn shell and the traditional Bourne shell

While the Bourne shell (or bash) is still popular as the “standard” shell, the Korn shell is gaining users, and here is why. Ksh is compatible with bash, but it has unique features. Plus, ksh comes with virtually the best features of the C shell. Ksh also allows for seamless command-line editing so a user can easily fix errors, thanks to the C shell’s history algorithm. These features are not available to bash users, and that says it all.

Other differences include:

  • Ksh supports a choice of three command-line editors with vi, Emacs, and Gosling Emacs.
  • Some versions of ksh support associative arrays and built-in floating-point arithmetic operations

How to write a Korn shell script

It all starts by introducing the shebang:

Korn shell script

If you’re on an AIX system, use a text editor (ideally vi) for writing Korn scripts. Introduce the shebang and also add a script header to indicate the scriptwriter, date and maybe other info about the script (adding a script header is optional).

Korn shell scripts are saved with the .ksh extension. Thus, a Korn shell script can also be called a .ksh shell script or an AIX shell script.

As always, if you want to add comments to the script, write the comment info after the number symbol (#).

Example:

To add comments to the script

An example of a ksh shell script containing script header section

The operators available in Korn shell

Most of the Korn shell operators are similar to those in the C programming language. They are, however, arranged into two categories:

  1. 1. Arithmetic and Logical Operators
  1. 2. File Test Operators
Korn shell operators

How to get files from Linux in Windows

If you've got some files on your Linux partitions, but you're working in Windows, DiskInternals Linux Reader can help you to grab your files from those Linux partitions. This software is especially designed for dual-boot PC users. It works perfectly and supports virtually all Linux partitions. Also, DiskInternals Linux Reader features an easy-to-read interface. DiskInternals Linux Reader is free to download and has many great features.

Related articles

FREE DOWNLOADVer 4.22, WinUpgrade to PROFrom $29.95

Please rate this article.
51 reviews