O'Reilly logo

Linux and Unix Shell Programming by David Tansley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

16.2. What a script contains

This book is not about good scripting design techniques, but good reusable code. You do not have to make the script complicated when it can achieve the same results through solid understandable code. If I wrote a book that way, I might impress you, but it would take a lot longer for you to get to grips with the code. This is not my goal; my code works and it works using basic scripting techniques, which you will learn more quickly. You will then be able to impress your friends more quickly!

A script is not a compiled program: it is interpreted, line by line. The first line of the script should always start with

#!/bin/sh 

This lets the shell know where the Bourne shell interpreter is to be found on the system.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required