Index: branches/eam_branches/ipp-20220316/Ohana/src/opihi/cmd.basic/run_while.c
===================================================================
--- branches/eam_branches/ipp-20220316/Ohana/src/opihi/cmd.basic/run_while.c	(revision 42164)
+++ branches/eam_branches/ipp-20220316/Ohana/src/opihi/cmd.basic/run_while.c	(revision 42165)
@@ -72,5 +72,6 @@
   // test the logic once before running the loop
   logic_line = strcreate (argv[1]);
-  logic_line = expand_vars (logic_line);
+  logic_line = expand_vars (logic_line); // recalculates scalar elements
+  logic_line = expand_vectors (logic_line); // recalculates vector/matrix elements (e.g., vec[])
   val = dvomath (1, &logic_line, &size, 0);
   free (logic_line);
@@ -90,5 +91,6 @@
 
     logic_line = strcreate (argv[1]);
-    logic_line = expand_vars (logic_line);
+    logic_line = expand_vars (logic_line); // recalculates scalar elements
+    logic_line = expand_vectors (logic_line); // recalculates vector/matrix elements (e.g., vec[])
     val = dvomath (1, &logic_line, &size, 0);
     free (logic_line);
Index: branches/eam_branches/ipp-20220316/Ohana/src/opihi/include/dvomath.h
===================================================================
--- branches/eam_branches/ipp-20220316/Ohana/src/opihi/include/dvomath.h	(revision 42164)
+++ branches/eam_branches/ipp-20220316/Ohana/src/opihi/include/dvomath.h	(revision 42165)
@@ -125,4 +125,5 @@
 int           M_unary               PROTO((StackVar *OUT, StackVar *V1, char *op));
 int           W_unary               PROTO((StackVar *OUT, StackVar *V1, char *op));
+int           L_unary               PROTO((StackVar *OUT, StackVar *V1, char *op));
 
 /* variable handling */
Index: branches/eam_branches/ipp-20220316/Ohana/src/opihi/lib.shell/evaluate_stack.c
===================================================================
--- branches/eam_branches/ipp-20220316/Ohana/src/opihi/lib.shell/evaluate_stack.c	(revision 42164)
+++ branches/eam_branches/ipp-20220316/Ohana/src/opihi/lib.shell/evaluate_stack.c	(revision 42165)
@@ -67,5 +67,9 @@
     if (stack[0].type == ST_VECTOR) {
       /* need to make a copy so we set output value? */
-      V_unary (&tmp_stack, &stack[0], "=");
+      if (stack->vector->type == OPIHI_STR) {
+	L_unary (&tmp_stack, &stack[0], "=");
+      } else {
+	V_unary (&tmp_stack, &stack[0], "=");
+      }
       move_stack (&stack[0], &tmp_stack);
       return (TRUE);
Index: branches/eam_branches/ipp-20220316/Ohana/src/opihi/lib.shell/expand_vectors.c
===================================================================
--- branches/eam_branches/ipp-20220316/Ohana/src/opihi/lib.shell/expand_vectors.c	(revision 42164)
+++ branches/eam_branches/ipp-20220316/Ohana/src/opihi/lib.shell/expand_vectors.c	(revision 42165)
@@ -28,7 +28,21 @@
   ALLOCATE (newline, char, NLINE);
 
+  // special case: don't expand vectors in while () statement
+  char *V0 = thiscomm (line);
+  if (V0 && !strncmp ("while", V0, strlen(V0))) {
+      strcpy (newline, line);
+      free (line);
+      return (newline);
+  }
+  free (V0);
+
   /* look for form fred[stuff] */
-  /* skip first word (command) */
-  L = nextword (line);
+  if (*line == '(') {
+    // if line is "(stuff)" then do not skip first word
+      L = line;
+  } else {
+    /* skip first word (command) */
+    L = nextword (line);
+  }
   if (L == NULL) {
     free (newline);
Index: branches/eam_branches/ipp-20220316/Ohana/src/opihi/lib.shell/stack_math.c
===================================================================
--- branches/eam_branches/ipp-20220316/Ohana/src/opihi/lib.shell/stack_math.c	(revision 42164)
+++ branches/eam_branches/ipp-20220316/Ohana/src/opihi/lib.shell/stack_math.c	(revision 42165)
@@ -1706,4 +1706,50 @@
   char line[512]; // this is only used to report an error 
   snprintf (line, 512, "error: op %s not defined as unary vector op!", op);
+  push_error (line);
+  return (FALSE);
+
+escape:
+
+  if (V1[0].type == ST_VECTOR_TMP) {
+    free (V1[0].vector[0].elements.Ptr);
+    free (V1[0].vector);
+    V1[0].vector = NULL;
+  }  
+
+  clear_stack (V1);
+  return (TRUE);
+
+}
+
+// vector string operations
+int L_unary (StackVar *OUT, StackVar *V1, char *op) {
+
+  int Nx = V1[0].vector[0].Nelements;
+
+  OUT[0].vector = InitVector ();
+  OUT[0].type = ST_VECTOR_TMP; /*** <<--- says this is a temporary matrix ***/
+
+  ResetVector (OUT[0].vector, OPIHI_STR, V1[0].vector[0].Nelements); 
+  char **Iv =  V1[0].vector[0].elements.Str; 
+  char **Ov = OUT[0].vector[0].elements.Str; 
+  if (!strcmp (op, "=")) {
+    for (int i = 0; i < Nx; i++) {			
+      Ov[i] = strcreate (Iv[i]);
+    }									
+    goto escape;							
+  }
+
+  // free the temp vector if needed
+  if (V1[0].type == ST_VECTOR_TMP) {
+    // XXX this probably does not free the strings
+    free (V1[0].vector[0].elements.Ptr);
+    free (V1[0].vector);
+    V1[0].vector = NULL;
+  }  
+
+  clear_stack (V1);
+
+  char line[512]; // this is only used to report an error 
+  snprintf (line, 512, "error: op %s not defined as unary string vector op!", op);
   push_error (line);
   return (FALSE);
