text: user285: These are my files 
  SO_8543_IP_3_ablt_R1.fq.gz
  SO_8543_IP_4_ablt_R1.fq.gz
  SO_8543_INPUT_1_ablt_R1.fq.gz  SO_8543_IP_5_ablt_R1.fq.gz
  SO_8543_INPUT_2_ablt_R1.fq.gz  SO_8543_IP_6_ablt_R1.fq.gz
  SO_8543_INPUT_3_ablt_R1.fq.gz  SO_8543_IP_7_ablt_R1.fq.gz
  SO_8543_INPUT_4_ablt_R1.fq.gz  SO_8543_IP_8_ablt_R1.fq.gz
  SO_8543_IP_1_ablt_R1.fq.gz     
  SO_8543_IP_2_ablt_R1.fq.gz
  
  Im running the below line 
  for i in $(ls *.fq*.gz | cut -f1-5 -d"_" | uniq);do echo $i; done
  
  bowtie2 -q -p20 -x /run/media/punit/data1/BowtieIndex/hg38  -1 ${i}_R1.fq.gz | samtools view -bS - >${i%}.bam;
  
  done
  
  So if i use run this 
  for i in $(ls *.fq*.gz | cut -f1-5 -d"_" | uniq);do echo $i; done
  
  I get files as such 
  SO_8543_INPUT_1_ablt
  SO_8543_INPUT_2_ablt
  SO_8543_INPUT_3_ablt
  SO_8543_INPUT_4_ablt
  SO_8543_IP_1_ablt
  SO_8543_IP_2_ablt
  SO_8543_IP_3_ablt
  SO_8543_IP_4_ablt
  SO_8543_IP_5_ablt
  SO_8543_IP_6_ablt
  SO_8543_IP_7_ablt
  SO_8543_IP_8_ablt
  
  The part of the file name that is consistent is _R1.fq.gz which goes after the input argument. As these are single end files so only 1 im giving one end as input.
  Error message 
  ***
  Error: Must specify at least one read input with -U/-1/-2
  (ERR): bowtie2-align exited with value 1
  ./Chip_SEQ.sh: line 25: syntax error near unexpected token `done'
  ./Chip_SEQ.sh: line 25: `done'
  
  it looks like its not able to recognize as input .Any help or suggestion would be highly appreciated 
  
  user77: You have an extra done, instead you want:
  for i in $(ls *.fq*.gz | cut -f1-5 -d"_" | uniq); do
      echo $i
      bowtie2 -q -p20 -x /run/media/punit/data1/BowtieIndex/hg38 -1 ${i}_R1.fq.gz | samtools view -bS - >${i}.bam
  done
  
  As an aside, I'm not a big fan of piping ls to cut and then uniq. Why not instead:
  for f in *.fq.gz; do
      sampleName=${f%%_R1.fq.gz}
      echo $sampleName
      bowtie2 -q ...
  done
  
  That will do the same thing, but (A) it's clearer what's going on and (B) it can be reused if your sample names change. Also, stop writing bash scripts and use snakemake or something like that instead, it scales much better and is less error-prone.
  
original_text: 285: <p>These are my files </p>
  
  <pre><code>SO_8543_IP_3_ablt_R1.fq.gz
  SO_8543_IP_4_ablt_R1.fq.gz
  SO_8543_INPUT_1_ablt_R1.fq.gz  SO_8543_IP_5_ablt_R1.fq.gz
  SO_8543_INPUT_2_ablt_R1.fq.gz  SO_8543_IP_6_ablt_R1.fq.gz
  SO_8543_INPUT_3_ablt_R1.fq.gz  SO_8543_IP_7_ablt_R1.fq.gz
  SO_8543_INPUT_4_ablt_R1.fq.gz  SO_8543_IP_8_ablt_R1.fq.gz
  SO_8543_IP_1_ablt_R1.fq.gz     
  SO_8543_IP_2_ablt_R1.fq.gz
  </code></pre>
  
  <p>Im running the below line </p>
  
  <pre><code>for i in <span class="math-container">$(ls *.fq*.gz | cut -f1-5 -d"_" | uniq);do echo $</span>i; done
  
  bowtie2 -q -p20 -x /run/media/punit/data1/BowtieIndex/hg38  -1 <span class="math-container">${i}_R1.fq.gz | samtools view -bS - &gt;$</span>{i%}.bam;
  
  done
  </code></pre>
  
  <p>So if i use run this </p>
  
  <pre><code>for i in <span class="math-container">$(ls *.fq*.gz | cut -f1-5 -d"_" | uniq);do echo $</span>i; done
  </code></pre>
  
  <p>I get files as such </p>
  
  <pre><code>SO_8543_INPUT_1_ablt
  SO_8543_INPUT_2_ablt
  SO_8543_INPUT_3_ablt
  SO_8543_INPUT_4_ablt
  SO_8543_IP_1_ablt
  SO_8543_IP_2_ablt
  SO_8543_IP_3_ablt
  SO_8543_IP_4_ablt
  SO_8543_IP_5_ablt
  SO_8543_IP_6_ablt
  SO_8543_IP_7_ablt
  SO_8543_IP_8_ablt
  </code></pre>
  
  <p>The part of the file name that is consistent is <code>_R1.fq.gz</code> which goes after the input argument. As these are single end files so only 1 im giving one end as input.</p>
  
  <p>Error message </p>
  
  <pre><code>***
  Error: Must specify at least one read input with -U/-1/-2
  (ERR): bowtie2-align exited with value 1
  ./Chip_SEQ.sh: line 25: syntax error near unexpected token `done'
  ./Chip_SEQ.sh: line 25: `done'
  </code></pre>
  
  <p>it looks like its not able to recognize as input .Any help or suggestion would be highly appreciated </p>
   77: <p>You have an extra <code>done</code>, instead you want:</p>
  
  <pre><code>for i in <span class="math-container">$(ls *.fq*.gz | cut -f1-5 -d"_" | uniq); do
      echo $</span>i
      bowtie2 -q -p20 -x /run/media/punit/data1/BowtieIndex/hg38 -1 <span class="math-container">${i}_R1.fq.gz | samtools view -bS - &gt;$</span>{i}.bam
  done
  </code></pre>
  
  <p>As an aside, I'm not a big fan of piping <code>ls</code> to cut and then uniq. Why not instead:</p>
  
  <pre><code>for f in *.fq.gz; do
      sampleName=<span class="math-container">${f%%_R1.fq.gz}
      echo $</span>sampleName
      bowtie2 -q ...
  done
  </code></pre>
  
  <p>That will do the same thing, but (A) it's clearer what's going on and (B) it can be reused if your sample names change. Also, stop writing bash scripts and use snakemake or something like that instead, it scales much better and is less error-prone.</p>
  