hush: reinstate [[ builtin
authorDenys Vlasenko <vda.linux@googlemail.com>
Wed, 11 Jan 2017 13:22:00 +0000 (14:22 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Wed, 11 Jan 2017 13:22:00 +0000 (14:22 +0100)
Mike deleted it:

    commit 39456a18a104b228de240b265bd943251219849d
    Author: Mike Frysinger <vapier@gentoo.org>
    Date:   Sat Mar 28 12:21:57 2009 +0000

    stop lying about [[ test support

probably because it was not properly ifdefed around, and was enabled
even when bash compat is off.

I just tested it - it works:

$ [ *.diff = z.diff ]; echo $?
0
$ [[ *.diff = z.diff ]]; echo $?
1

Of course, not all numerous bash tricks of [[ ]] are implemented...

function                                             old     new   delta
bltins2                                               60      72     +12

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/hush.c

index fb0321a2cbeeb7f1dd81b38115980f9b193c9e3e..d90c1485a4411db96bcd7fa558e215578f2ad459 100644 (file)
@@ -1083,6 +1083,9 @@ static const struct built_in_command bltins2[] = {
 #if ENABLE_HUSH_TEST
        BLTIN("["        , builtin_test    , NULL),
 #endif
+#if BASH_TEST2
+       BLTIN("[["       , builtin_test    , NULL),
+#endif
 #if ENABLE_HUSH_ECHO
        BLTIN("echo"     , builtin_echo    , NULL),
 #endif