text: user4401: I am trying to download multiple fastq files from the SRA NCBI database which, conveniently enough, have their IDs in a range. Building a simple loop doesn't seem to do the trick, as bash appears to interpret my variable as an additional command? Help would be appreciated. This is what I have for now:
  for i in {256..345};do
      sra_code = "DRR163""$i"
  fasterq-dump "$sra_code" -p -v --outdir ./output/ -e 8 
  
  done
  ```
  
  
  user298: You have an obvious error in your shell script that should have given you an error message:
  sra_code = "DRR163""$i"
  
  Should be:
  sra_code="DRR163""$i"
  
  You cannot have spaces around the = sign in a variable assignment. The line sra_code = "DRR163""$i" means "run the command sra_code with the arguments = "DRR163""$i". Since there is no such command, you see an error.
  Here's a working version of your command:
  for i in {256..345}; do 
      sra_code="DRR163$i"
      fasterq-dump "$sra_code" -p -v --outdir ./output/ -e 8
  done
  
  
original_text: 4401: <p>I am trying to download multiple fastq files from the SRA NCBI database which, conveniently enough, have their IDs in a range. Building a simple loop doesn't seem to do the trick, as bash appears to interpret my variable as an additional command? Help would be appreciated. This is what I have for now:</p>
  <pre><code>for i in {256..345};do
      sra_code = &quot;DRR163&quot;&quot;<span class="math-container">$i"
  fasterq-dump "$</span>sra_code&quot; -p -v --outdir ./output/ -e 8 
  
  done
  <span class="math-container">```</span>
  </code></pre>
   298: <p>You have an obvious error in your shell script that should have given you an error message:</p>
  <pre><code>sra_code = &quot;DRR163&quot;&quot;$i&quot;
  </code></pre>
  <p>Should be:</p>
  <pre><code>sra_code=&quot;DRR163&quot;&quot;$i&quot;
  </code></pre>
  <p>You cannot have spaces around the <code>=</code> sign in a variable assignment. The line <code>sra_code = &quot;DRR163&quot;&quot;$i&quot;</code> means &quot;run the command <code>sra_code</code> with the arguments <code>= &quot;DRR163&quot;&quot;$i&quot;</code>. Since there is no such command, you see an error.</p>
  <p>Here's a working version of your command:</p>
  <pre><code>for i in {256..345}; do 
      sra_code=&quot;DRR163<span class="math-container">$i"
      fasterq-dump "$</span>sra_code&quot; -p -v --outdir ./output/ -e 8
  done
  </code></pre>
  