如何在linux中使用for循环生成以下行?
zcat ~/tools/sample66621D.fastq | bowtie2 -a - | samtools ->sample66621D.BAM
zcat ~/tools/sample66622D.fastq | bowtie2 -a - | samtools ->sample66622D.BAM
zcat ~/tools/sample66623D.fastq | bowtie2 -a - | samtools ->sample66623D.BAM
我试过了:
for ((a=21;a<=23;a++))
echo "zcat ~/tools/sample666$aD.fastq | bowtie2 -a - | samtools ->sample666$aD.BAM"
done
但它变成了三条相同的线。
zcat ~/tools/sample666.fastq | bowtie2 -a - | samtools ->sample666.BAM
zcat ~/tools/sample666.fastq | bowtie2 -a - | samtools ->sample666.BAM
zcat ~/tools/sample666.fastq | bowtie2 -a - | samtools ->sample666.BAM
感谢
答案 0 :(得分:0)
$aD
是有效的变量名称。您必须用括号分隔变量名称,即${a}
。