The strcmp command is used for string comparison in control structures.
strcmp [varname] string1 string2This supports the original Spice3 strcmp which returns is value in a given variable, and the WRspice convention where the comparison value is returned in the global return value (accessible with ``$?'').
In either case, the comparison value is a number that is less than, equal to, or greater than zero according to whether string1 is lexically before, equal to, or after string2.
If three arguments are given, the first argument is taken as the name of a variable which is set to the comparison value. This convention is supported for backwards compatibility, of this function only. Otherwise, the global return value will be set to this value. The other arguments are literal strings.
set str1="abcd efgh"
set str2="bbcd efgh"
strcmp "$str1" "$str2"
if ($? < 0)
echo "$str1" ahead of "$str2"
if ($? = 0)
echo strings are the same
echo "$str1" after "$str2"