#!/bin/ksh Explained

As discussed previously, a shell script is nothing more than a set of commands saved in a file. When the script is executed, the set of commands in the file are passed to an interpreter for processing. Several shells are available that a script writer can choose. How do you indicate that your script is a Korn Shell script, and is to be interpreted by ksh (and not csh, sh, bash, tcsh, or any other shell program)?

In shell scripting, the way to do this is to make the first line of the script file contain special characters that will precede a file specification locating the program responsible for interpreting the remaining lines in the file.

Normally a pound sign (#) begins a comment. Comments are lines in the script file ...

Get Korn Shell Programming by Example 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.