This patch allows for doing [[ condition1 -a condition2 ]] 

diff -urwN busybox-1.10.0.orig/shell/ash.c busybox-1.10.0/shell/ash.c
--- busybox-1.10.0.orig/shell/ash.c     2008-03-24 12:40:29.000000000 -0400
+++ busybox-1.10.0/shell/ash.c  2008-03-24 12:57:45.000000000 -0400
@@ -10008,7 +10008,7 @@
        union node *n = NULL;
        union node *vars, **vpp;
        union node **rpp, *redir;
-       int savecheckkwd;
+       int savecheckkwd, flag = 0;
 
        args = NULL;
        app = &args;
@@ -10021,11 +10021,24 @@
        for (;;) {
                checkkwd = savecheckkwd;
                switch (readtoken()) {
+               case TAND:
+                       wordtext = (char *) "-a";
+               case TOR:
+                       if (strcmp(wordtext, "&&"))
+                               wordtext = (char *) "-o";
+                       if (!flag) {
+                               tokpushback++;
+                               goto out;
+                       }
                case TWORD:
                        n = stzalloc(sizeof(struct narg));
                        n->type = NARG;
                        /*n->narg.next = NULL; - stzalloc did it */
                        n->narg.text = wordtext;
+                       if (!strcmp("[[", wordtext))
+                               flag = 1;
+                       else if (!strcmp("]]", wordtext))
+                               flag = 0;
                        n->narg.backquote = backquotelist;
                        if (savecheckkwd && isassignment(wordtext)) {
                                *vpp = n;
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to