* File type tests:: -[bcdfhLpSt]
* Access permission tests:: -[gkruwxOG]
* File characteristic tests:: -e -s -nt -ot -ef
-* String tests:: -z -n = !=
+* String tests:: -z -n = == !=
* Numeric tests:: -eq -ne -lt -le -gt -ge
* Connectives for test:: ! -a -o
@end menu
@cindex equal string check
True if the strings are equal.
+@item @var{string1} == @var{string2}
+@opindex ==
+@cindex equal string check
+True if the strings are equal (synonym for =).
+
@item @var{string1} != @var{string2}
@opindex !=
@cindex not-equal string check
static bool
binop (char const *s)
{
- return ((STREQ (s, "=")) || (STREQ (s, "!=")) || (STREQ (s, "-nt")) ||
+ return ((STREQ (s, "=")) || (STREQ (s, "!=")) || (STREQ (s, "==")) ||
+ (STREQ (s, "-nt")) ||
(STREQ (s, "-ot")) || (STREQ (s, "-ef")) || (STREQ (s, "-eq")) ||
(STREQ (s, "-ne")) || (STREQ (s, "-lt")) || (STREQ (s, "-le")) ||
(STREQ (s, "-gt")) || (STREQ (s, "-ge")));
test_syntax_error (_("unknown binary operator"), argv[op]);
}
- if (argv[op][0] == '=' && !argv[op][1])
+ if (argv[op][0] == '=' && (!argv[op][1] ||
+ ((argv[op][1] == '=') && !argv[op][2])))
{
bool value = STREQ (argv[pos], argv[pos + 2]);
pos += 3;