Index: /trunk/Ohana/src/opihi/cmd.basic/run_if.c
===================================================================
--- /trunk/Ohana/src/opihi/cmd.basic/run_if.c	(revision 41387)
+++ /trunk/Ohana/src/opihi/cmd.basic/run_if.c	(revision 41388)
@@ -5,5 +5,5 @@
 
   int ThisList, depth, done, status, InlineCommand;
-  int i, length, logic;
+  int i, length, logic, foundElse;
   char *input, *val, *line;
   int nloop, size;
@@ -60,4 +60,5 @@
   ThisList = current_list_depth();
 
+  foundElse = FALSE;
   done = FALSE;
   while (!done) {
@@ -91,6 +92,12 @@
     /* check for an "else", invert logic */
     if ((depth == 0) && !strncasecmp (input, "ELSE", 4)) {
-      logic ^= TRUE;
+      logic = !logic;
       free (input);
+
+      if (foundElse) {
+	gprint (GP_ERR, "multiple 'ELSE' statements in if-block with 'END'\n");
+	return FALSE;
+      }
+      foundElse = TRUE;
       continue;
     }
