我是 bash 的新手,想獲得有關如何運行 for 回圈的幫助。
這是我的問題,我有 10 個不同的排序 bam 檔案(*.sorted.bam),我想為每個排序的 bam 檔案建立索引。
我知道如何使用以下命令為單個檔案運行它
samtools index sample.sorted.bam
如果有人能告訴我如何運行多個檔案,我會很高興
最好的,阿瑪瑞
uj5u.com熱心網友回復:
你可以像這樣使用 for..in 回圈:
for file in *.sorted.bam
do
samtools index "$file"
done
或在一行中:
for file in *.sorted.bam; do samtools index "$file"; done
您可以在此處找到有關 bash 回圈結構的更多資訊:https : //www.gnu.org/software/bash/manual/bash.html#Looping-Constructs
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/358070.html
標籤:猛击
