title: Is it possible to use GNU parallel with a yes/no prompt for each job?
body: <p>I have many files that I would like to concatenate. Here is an example which generates those file names with some example content:</p>
  <pre class="lang-bash prettyprint-override"><code>for lane in $(seq 1 4)
  do
      for sub in $(seq 1 8)
      do
          echo &quot;sublib ${sub}, lane ${lane}, R1&quot; &gt; S${sub}_L00${lane}_R1.fastq.gz
          echo &quot;sublib ${sub}, lane ${lane}, R2&quot; &gt; S${sub}_L00${lane}_R2.fastq.gz
      done
  done
  </code></pre>
  <p>To concatenate these files using GNU parallel I've created the shell function below, but because these files are very large in practice, I would like enable a check which prompts the user for a &quot;Yes&quot; or &quot;No&quot; to verify the correct files are being combined before each job is executed.</p>
  <p>Given that parallel executes each job simultaneously, is there a way to &quot;pause&quot; each job while the user input &quot;Yes&quot; or &quot;No&quot; is passed serially?</p>
  <pre class="lang-bash prettyprint-override"><code>export FQ_DIR=&quot;/volume-general/test-fastqs/concat-demo/&quot;
  function concat_fq () {
      files=$(find ${FQ_DIR} -type f -name &quot;${1}_L*R${2}*&quot;)
      printf &quot;Files to concatenate:\n$files\n\n&quot;
      read -p &quot;Proceed? [y/n]?&quot; yn
          case $yn in
              [Yy]* ) cat &quot;$files&quot; &gt; ${FQ_DIR}${1}_cat_R${2}.fastq.gz;;
              [Nn]* ) echo &quot;Aborting.&quot;;;
          esac
  }
  
  export -f concat_fq
  
  # example run
  parallel -k --lb concat_fq {} ::: S1 S2 ::: 1 2
  </code></pre>