As stated earlier, the method for comparing expressions in
tcsh is different from the method used under
bash. The comparison of expression demonstrated in this section uses the syntax necessary for the
tcsh shell environment.
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,
string2, in the shell program
#!/bin/tcshset string1 = "abc"set string2 = ""abd"if (string1 == string2) then echo "string1 equal to string2"else echo ""string1 not equal to string2"endifif (string2 != string1) then echo ""string2 ...