title: echo into a .sh file
body: <p>I am writing a script with the goal of generating a large number of other scripts. I am using a for loop that echo's the text of the code I want for each script and then > it into a .sh file. Here is how I wrote it:</p>
  
  <pre><code>#!/bin/bash
  
  
  for i in {1..30} ; do
  
  echo
  
  "#!/bin/bash
  #$ -N DT_STAR_$i
  #$ -l mem_free=200G
  #$ -pe openmp 4
  #$ -q bio,abio,pub8i
  
  module load STAR/2.5.2a
  
  
  STAR  --genomeDir /dfs1/bio/dtatarak/indexes/STAR_Index --readFilesIn 
  DT_$i.read1.fastq DT_$i.read2.fastq --runThreadN 4 --outFileNamePrefix 
  /David_data1/DT_$i"  &gt; DT_STAR_map_$i.sh
  
  
  done
  </code></pre>
  
  <p>Basically what I want it to do is take all the lines of code inside the ' ' and put them into a new .sh file each time changing DT_i to DT_1, DT_2, DT_3, etc. when I run this script in the terminal, it does make all of the .sh files, but doesn't put anything in them. and it prints the contents of the quotes to my screen with the message "No such file or directory". I'm not sure what I'm doing wrong. Is there a better way to achieve what I'm trying to do?</p>
  
  <p>Thanks!</p>