所以我对unix编码很新,而且我有一个相当简单的任务,我似乎无法理解。
我的桌面上有一个包含多个.fq
文件(Desktop/btindex
)的文件夹,我正在寻找一种方法来迭代shell脚本中的那些文件,并调用它们上的命令。我似乎无法找到正确的语法来执行此操作。
最好是从控制台的vim这样的编辑器中编写这个脚本吗? 或者将它全部写在控制台本身更好?
编辑: 我在Desktop / bwaout目录下工作,所以我的代码:
for file in '../btindex/*.fq';
do
echo $file
done
好像打印......
../btindex/X.fq
我如何才能打印.fq?
答案 0 :(得分:0)
使用for
循环,如下所示:
for file in /some/path/*.fq
do
echo "Processing file: $file"
# other commands here
done
答案 1 :(得分:0)
for myfile in *.fq ; do command "$myfile" ; another_command "$myfile" ; done