Skip to Content
How Linux Works, 2nd Edition
book

How Linux Works, 2nd Edition

by Brian Ward
November 2014
Beginner to intermediate
392 pages
11h
English
No Starch Press
Content preview from How Linux Works, 2nd Edition

Chapter 11. Introduction to Shell Scripts

image with no caption

If you can enter commands into the shell, you can write shell scripts (also known as Bourne shell scripts). A shell script is a series of commands written in a file; the shell reads the commands from the file just as it would if you typed them into a terminal.

11.1 Shell Script Basics

Bourne shell scripts generally start with the following line, which indicates that the /bin/sh program should execute the commands in the script file. (Make sure that no whitespace appears at the beginning of the script file.)

#!/bin/sh

The #! part is called a shebang; you’ll see it in other scripts in this book. You can list any ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

How Linux Works, 3rd Edition

How Linux Works, 3rd Edition

Brian Ward
Understanding the Linux Kernel, 3rd Edition

Understanding the Linux Kernel, 3rd Edition

Daniel P. Bovet, Marco Cesati
Linux Fundamentals

Linux Fundamentals

Sander van Vugt

Publisher Resources

ISBN: 9781457185519Errata