07a490
diff --git a/subst.c b/subst.c
07a490
index 1dbfb5e..049962e 100644
07a490
--- a/subst.c
07a490
+++ b/subst.c
07a490
@@ -5011,7 +5011,8 @@ process_substitute (string, open_for_read_in_child)
07a490
 
07a490
 #if defined (JOB_CONTROL)
07a490
   old_pipeline_pgrp = pipeline_pgrp;
07a490
-  pipeline_pgrp = shell_pgrp;
07a490
+  if (pipeline_pgrp == 0 || (subshell_environment & (SUBSHELL_PIPE|SUBSHELL_FORK|SUBSHELL_ASYNC)) == 0)
07a490
+    pipeline_pgrp = shell_pgrp;
07a490
   save_pipeline (1);
07a490
 #endif /* JOB_CONTROL */
07a490
 
07a490
-- 
07a490
2.9.3
07a490