title: How to redirect output to different directory in BASH?
body: <p>I have 3 directories named: /home/user/control4 , /home/user/control8 ,/home/user/control16 </p>
  
  <p>I have written a script file which has two loops , the first one is running a simulation, producing 3 files named cc1.txt cc2.txt, and cc3.txt and a second loop is for the names of directory </p>
  
  <p>I like to direct cc1.txt, cc2.txt, cc3.txt to /home/user/control4,/home/user/control8 ,/home/user/control16, respectively. What is the exact syntax for doing this in BASH? </p>
  
  <p>Thanks for your help. </p>
  
  <p>My script file look likes this </p>
  
  <pre><code>#!/user/bin/bash
  for j in $(4 8 16 ) # loop for directories
  do
  for i in $(seq 1 3) # loop for simulations  
  do
  .... produce cc1.txt cc2.txt cc3.txt 
  done
  </code></pre>
  
  <p>How to output the three files to the respective directories? something like /home/user/control$j/cc$i.txt?</p>
  
  <p>done</p>