views:

197

answers:

3

#!/bin/ksh is the first line in a shell script always

what is the importance of this line and why is it kept as the first line.

A: 

it signals that the script is to be executed by ksh (instead of any of the other shells)

Hans Kesting
+6  A: 

This line tells the operating system what interpreter to invoke to run the script.

Without it, there's no way to know that this script needs to be run using the ksh interpreter.

The sequence is known as a "shebang", and you can read more about it on Wikipedia.

unwind
+1  A: 

If the file is executable, it tells the os, which program can execute the script.

Aurril