我有一个类似file.txt的文件:
Specie1
Specie2
Specie3我有一个在这3个物种上运行的程序,叫做bedtools getfasta
所以我的想法是:
cat file_species.txt |
while read line; do
bedtools getfasta -fi /path/${line}/${line}.fa -bed /path/${line}/Recover_fasta.bed -s -fo /path/${line}/Fasta_loci_seq.fa" ;
done如果我做一个echo,我会得到:
bedtools getfasta -fi /path/Specie1/Specie1.fa -bed /path/Specie1/Recover_fasta.bed -s -fo /path/Specie1/Fasta_loci_seq.fa" ;
done
bedtools getfasta -fi /path/Specie2/Specie2.fa -bed /path/Specie1/Recover_fasta.bed -s -fo /path/Specie1/Fasta_loci_seq.fa" ;
done
bedtools getfasta -fi /path/Specie3/Specie3.fa -bed /path/Specie1/Recover_fasta.bed -s -fo /path/Specie1/Fasta_loci_seq.fa" ;
done如果我只是跳过这些代码,那么我怎么能在"do"之后的第一个脚本中执行它,而不是执行回显,然后粘贴代码呢?
发布于 2019-02-04 22:35:31
去掉尾部的双引号和分号,用"$line"替换${line}:
cat file_species.txt |
while read line; do
bedtools getfasta -fi /path/"$line"/"$line".fa -bed /path/"$line"/Recover_fasta.bed -s -fo /path/"$line"/Fasta_loci_seq.fa
donehttps://stackoverflow.com/questions/54517386
复制相似问题