Comparing Expressions with tcsh
As stated earlier, the method for comparing expressions in tcsh
is different from the method used under pdksh
and bash
. The comparison of expression demonstrated in this section uses the syntax necessary for the tcsh
shell environment.
String Comparison
You can use the following operators to compare two string expressions:
==—To compare whether two strings are equal.
!=—To compare whether two strings are not equal.
The following examples compare two strings, string1
and string2
, in the shell program compare1
:
Get Ubuntu Unleashed 2015 Edition: Covering 14.10 and 15.04, Tenth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.