07a490
--- bash-4.2/parse.y	2014-05-29 14:46:09.545543384 +0200
07a490
+++ bash-4.2/parse.y	2014-05-29 14:48:40.758626213 +0200
07a490
@@ -3858,6 +3858,8 @@ xparse_dolparen (base, string, indp, fla
07a490
     sflags |= SEVAL_NOLONGJMP;
07a490
   save_parser_state (&ps);
07a490
   save_input_line_state (&ls);
07a490
+  /* avoid echoing every substitution again */
07a490
+  echo_input_at_read = 0;
07a490
 
07a490
   /*(*/
07a490
   parser_state |= PST_CMDSUBST|PST_EOFTOKEN;	/* allow instant ')' */ /*(*/
07a490
--- bash-4.2/subst.c	2014-05-29 16:04:35.802784549 +0200
07a490
+++ bash-4.2/subst.c	2014-05-29 16:08:25.021942676 +0200
07a490
@@ -7103,6 +7103,7 @@ param_expand (string, sindex, quoted, ex
07a490
   WORD_LIST *list;
07a490
   WORD_DESC *tdesc, *ret;
07a490
   int tflag;
07a490
+  int old_echo_input;
07a490
 
07a490
   zindex = *sindex;
07a490
   c = string[++zindex];
07a490
@@ -7401,6 +7402,9 @@ arithsub:
07a490
 	}
07a490
 
07a490
 comsub:
07a490
+      old_echo_input = echo_input_at_read;
07a490
+      /* avoid echoing every substitution again */
07a490
+      echo_input_at_read = 0;
07a490
       if (pflags & PF_NOCOMSUB)
07a490
 	/* we need zindex+1 because string[zindex] == RPAREN */
07a490
 	temp1 = substring (string, *sindex, zindex+1);
07a490
@@ -7413,6 +7417,7 @@ comsub:
07a490
 	}
07a490
       FREE (temp);
07a490
       temp = temp1;
07a490
+      echo_input_at_read = old_echo_input;
07a490
       break;
07a490
 
07a490
     /* Do POSIX.2d9-style arithmetic substitution.  This will probably go