Skip to Main Content
UNIX® Shells by Example, Third Edition
book

UNIX® Shells by Example, Third Edition

by Ellie Quigley
October 2001
Intermediate to advanced content levelIntermediate to advanced
1040 pages
22h 50m
English
Pearson
Content preview from UNIX® Shells by Example, Third Edition

6.1. Comparison Expressions

Comparison expressions match lines where if the condition is true, the action is performed. These expressions use relational operators and are used to compare numbers or strings. Table 6.1 provides a list of the relational operators. The value of the expression is 1 if the expression evaluates true, and 0 if false.

6.1.1. Relational Operators

Table 6.1. Relational Operators
Operator Meaning Example
< Less than. x < y
<= Less than or equal to. x <= y
== Equal to. x == y
!= Not equal to. x != y
>= Greater than or equal to. x >= y
> Greater than. x > y
~ Matched by regular expression. x ~ /y/
!~ Not matched by regular expression. x !~ /y/
Example 6.1.
(The Database)
% cat employee
						Tom Jones      4423      5/12/66   543354
						Mary ...
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

UNIX® Shells by Example Fourth Edition

UNIX® Shells by Example Fourth Edition

Ellie Quigley
Storage Area Networks For Dummies®

Storage Area Networks For Dummies®

Christopher Poelker, Alex Nikitin

Publisher Resources

ISBN: 013066538XPurchase book