我有32个文件(按相同的模式命名,唯一的区别是$样本编号,如下所示),我想将它们分成4个文件夹。我尝试使用以下脚本来完成这项工作,但脚本无法正常工作,请有人帮我解决以下shell脚本吗?-谢谢
#!/bin/bash
max=8 #8 files in each sub folder
numberFolder=4
sample=0
while ($numberFolder > 1) #skip the current folder, as 8 files will remain
do
for (i=1; i<9; i++)
do
$sample= $i * $numberFolder # this distinguish one sample file from another
echo "tophat_"$sample"_ACTTGA_L003_R1_001" //just an echo test, if works, will replace it with "cp".
done
$numberFolder--
end
while (( numberFolder > 1 ))
必须以双重(( ))
的方式编写,与for
循环相同。 - Charles Duffy(( sample = i * numberFolder ))
,(( numberFolder-- ))
。值得注意的是,在数学环境中,您 不需要 使用$
。 - Charles Duffy