From 75ac42b1aea14abbd8633003a6c56fa28c27a6c9 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 14 Apr 2005 02:49:22 +0000 Subject: add aliases == and [[ for = and [ to support more bash scripts --- coreutils/test.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'coreutils/test.c') diff --git a/coreutils/test.c b/coreutils/test.c index 8fa6d166f..cec3c471d 100644 --- a/coreutils/test.c +++ b/coreutils/test.c @@ -51,7 +51,7 @@ unary-operator ::= "-r"|"-w"|"-x"|"-f"|"-d"|"-c"|"-b"|"-p"| "-u"|"-g"|"-k"|"-s"|"-t"|"-z"|"-n"|"-o"|"-O"|"-G"|"-L"|"-S"; - binary-operator ::= "="|"!="|"-eq"|"-ne"|"-ge"|"-gt"|"-le"|"-lt"| + binary-operator ::= "="|"=="|"!="|"-eq"|"-ne"|"-ge"|"-gt"|"-le"|"-lt"| "-nt"|"-ot"|"-ef"; operand ::= */ @@ -135,6 +135,7 @@ static const struct t_op { "-L", FILSYM, UNOP}, { "-S", FILSOCK, UNOP}, { "=", STREQ, BINOP}, { + "==", STREQ, BINOP}, { "!=", STRNE, BINOP}, { "<", STRLT, BINOP}, { ">", STRGT, BINOP}, { @@ -191,6 +192,11 @@ extern int test_main(int argc, char **argv) bb_error_msg_and_die("missing ]"); argv[argc] = NULL; } + if (strcmp(bb_applet_name, "[[") == 0) { + if (strcmp(argv[--argc], "]]")) + bb_error_msg_and_die("missing ]]"); + argv[argc] = NULL; + } /* Implement special cases from POSIX.2, section 4.62.4 */ switch (argc) { case 1: -- cgit v1.2.3