rcolebaugh / rpms / bash

Forked from rpms/bash a year ago
Clone
Petr Šabata 33fc6c
diff --git a/parse.y b/parse.y
DistroBaker 62c465
index df1231d..2449fa8 100644
Petr Šabata 33fc6c
--- a/parse.y
Petr Šabata 33fc6c
+++ b/parse.y
DistroBaker 62c465
@@ -4482,6 +4482,8 @@ xparse_dolparen (base, string, indp, flags)
Petr Šabata 33fc6c
   save_parser_state (&ps);
Petr Šabata 33fc6c
   save_input_line_state (&ls);
Petr Šabata 33fc6c
   orig_eof_token = shell_eof_token;
Petr Šabata 33fc6c
+  /* avoid echoing every substitution again */
Petr Šabata 33fc6c
+  echo_input_at_read = 0;
Petr Šabata 33fc6c
 #if defined (ALIAS) || defined (DPAREN_ARITHMETIC)
Petr Šabata 33fc6c
   saved_pushed_strings = pushed_string_list;	/* separate parsing context */
Petr Šabata 33fc6c
   pushed_string_list = (STRING_SAVER *)NULL;
Petr Šabata 33fc6c
diff --git a/subst.c b/subst.c
DistroBaker 62c465
index 9ccbf33..8a9ee5c 100644
Petr Šabata 33fc6c
--- a/subst.c
Petr Šabata 33fc6c
+++ b/subst.c
DistroBaker 62c465
@@ -9453,6 +9453,7 @@ param_expand (string, sindex, quoted, expanded_something,
DistroBaker 62c465
   WORD_LIST *list, *l;
Petr Šabata 33fc6c
   WORD_DESC *tdesc, *ret;
DistroBaker 62c465
   int tflag, nullarg;
Petr Šabata 33fc6c
+  int old_echo_input;
Petr Šabata 33fc6c
 
Petr Šabata 33fc6c
 /*itrace("param_expand: `%s' pflags = %d", string+*sindex, pflags);*/
Petr Šabata 33fc6c
   zindex = *sindex;
DistroBaker 62c465
@@ -9843,6 +9844,9 @@ arithsub:
Petr Šabata 33fc6c
 	}
Petr Šabata 33fc6c
 
Petr Šabata 33fc6c
 comsub:
Petr Šabata 33fc6c
+      old_echo_input = echo_input_at_read;
Petr Šabata 33fc6c
+      /* avoid echoing every substitution again */
Petr Šabata 33fc6c
+      echo_input_at_read = 0;
Petr Šabata 33fc6c
       if (pflags & PF_NOCOMSUB)
Petr Šabata 33fc6c
 	/* we need zindex+1 because string[zindex] == RPAREN */
Petr Šabata 33fc6c
 	temp1 = substring (string, *sindex, zindex+1);
DistroBaker 62c465
@@ -9855,6 +9859,7 @@ comsub:
Petr Šabata 33fc6c
 	}
Petr Šabata 33fc6c
       FREE (temp);
Petr Šabata 33fc6c
       temp = temp1;
Petr Šabata 33fc6c
+      echo_input_at_read = old_echo_input;
Petr Šabata 33fc6c
       break;
Petr Šabata 33fc6c
 
Petr Šabata 33fc6c
     /* Do POSIX.2d9-style arithmetic substitution.  This will probably go