Skip to Main Content
Expert Shell Scripting
book

Expert Shell Scripting

by Ron Peters
December 2008
Intermediate to advanced content levelIntermediate to advanced
320 pages
6h 45m
English
Apress
Content preview from Expert Shell Scripting

CHAPTER 4Comparisons and Tests

Two of the fundamental types of operations in any programming language are the comparison and the test. They are the building blocks of conditional statements (if/then and case) and iteration statements (while). They give you the ability to examine relationships between data items, such as files, variables, strings, and numeric values, and to take action based on the result. You can also carry out actions based on the attributes of a particular item, such as a file's type, whether a variable has been assigned a value, and the return code of a command.

The examples in this chapter illustrate various ways to compare items or to check their properties, and use the results. I have used all of these techniques throughout ...

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

Robust Shell Scripting

Robust Shell Scripting

Arnold Robbins
Hacker Techniques, Tools, and Incident Handling

Hacker Techniques, Tools, and Incident Handling

Sean-Philip Oriyano, Michael Gregg

Publisher Resources

ISBN: 9781430218418Purchase book