1
我遇到以下問題;兩個目錄,包含:bash:for循環,鏈接兩個變量
- DIR1:
file1.fq file2.fq file3.fq
等..
-
:類似下面的文件列表
- dir2:下面這樣的文件:
f ile1.fq.sa file2.fq.sa file3.fq.sa
什麼,我要做的就是運行使用file1.fq和file1.fq.sa在一起的命令。
我嘗試了以下循環:
fq=dir1/*
sa=dir2/*
for fqfiles in $fq;
do
for sa_files in $sa;
do
mycommand ${sa_files} ${fqfiles} > ${sa_files}.cc &
done
done
的問題是,我的循環執行以下命令:
mycommand file1.fq.sa file1.fq > file1.fq.sa.cc #correct
而且
mycommand file1.fq.sa file2.fq > file1.fq.sa.cc #wrong!
等..在幾乎無限的循環中!
我希望我的循環可以產生類似:
mycommand file1.fq.sa file1.fq > file1.fq.sa.cc
mycommand file2.fq.sa file2.fq > file2.fq.sa.cc
mycommand file3.fq.sa file3.fq > file3.fq.sa.cc
等等
你能幫幫我嗎?
謝謝!
法比奧
大!有用!謝謝。我將詳細研究basename選項! – fabioln79 2013-02-26 12:31:09