Book Image

Linux Mint Essentials

By : Jay LaCroix
Book Image

Linux Mint Essentials

By: Jay LaCroix

Overview of this book

Table of Contents (22 chapters)
Linux Mint Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using variables and conditional statements in Bash


We covered a brief introduction to Bash scripting at the end of Chapter 4, An Introduction to the Terminal. In the previous section, we created a simple script that monitors the temperature of your computer's CPU in almost real time. While useful, this script, in particular, won't save you a lot of time, since you can use the sensors command to do the same thing with almost the same amount of time. Bash really shines because of the fact that it has all the features you'd expect from an actual programming language, including if statements and variables. Bash scripting is used by many administrators to simplify and automate tasks. Paired with cron, you can easily create scripts to automatically run, and with enough skill, completely set up a Linux computer from a bare installation of a distribution to a fully functioning system for a specific purpose.

Before we continue, recall two very important requirements for scripting. First, the script...