Book Image

Linux Essentials - Second Edition

By : Christine Bresnahan, Richard Blum
Book Image

Linux Essentials - Second Edition

By: Christine Bresnahan, Richard Blum

Overview of this book

Linux Essentials, Second Edition provides a solid foundation of knowledge for anyone considering a career in information technology, for anyone new to the Linux operating system, and for anyone who is preparing to sit for the Linux Essentials Exam. Through this engaging resource, you can access key information in a learning-by-doing style. Hands-on tutorials and end-of-chapter exercises and review questions lead you in both learning and applying new information—information that will help you achieve your goals! With the experience provided in this compelling reference, you can sit down for the Linux Essentials Exam with confidence. An open-source operating system, Linux is a UNIX-based platform that is freely updated by developers. The nature of its development means that Linux is a low-cost and secure alternative to other operating systems, and is used in many different IT environments. Passing the Linux Essentials Exam prepares you to apply your knowledge regarding this operating system within the workforce.
Table of Contents (19 chapters)
17
EULA

Using Conditional Expressions

images

Scripting languages support several types of conditional expressions. These enable a script to perform one of several actions contingent on a particular condition—typically the value of a variable. One common command that uses conditional expressions is if, which allows the system to take one of two actions depending on whether a certain condition is true. The if keyword’s conditional expression appears in brackets after the if keyword and can take many forms. For instance, -f file is true if file exists and is a regular file; -s file is true if file exists and has a size greater than 0; and string1 == string2 is true if the two strings have the same values.

images

Conditionals may be combined together with the logical and (&&) or logical or (||) operators. When conditionals are combined with &&, both sides of the operator must be true for the condition as a whole to be true. When || is used, if either side of the operator is true...