Essential Linux

Chapter 4: bash shell scripts

Overview

The bash (Bourne again shell) program is the standard Linux shell and is based on the standard Bourne shell that most UNIX releases use. It has a lot of very sophisticated features thatallow users to change the environment and use shortcuts when moving around the file system. Probably the most powerful feature is the ability to create applications and utilities using a shell script. This is similar to the batch file concept within MS-DOS, where commands are read from a file rather than from a keyboard and are executed in sequence. Such batch files are used to automatically install software.

While the Linux command structure and the command options in particular are not very intuitive, the system administrator can ease this barrier by providing simpler commands for users using shell scripts. I have a whole set of scripts that I use for disk operations. It is easier to type in backup /user/steve than the equivalent Linux commands. Many applications have been written using shell scripts, including replacement interfaces. It is quite possible to write a shell script that simulates another user interface so the user is not aware that Linux is running.

The key to writing and using shell scripts is to recognize that they are fully fledged programs in their own right and that the scripting language provided is a programming language, much the same as BASIC or C. It features variables, arithmetic operations, condition testing, and control structures such as FORNEXT, IF-THEN_ELSE and WHILE-DO-DONE loops. One...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Console Consolidation Systems
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.