我的脚本:
我想复制包含 THx 或 THy 的文件,但是文件没有被复制。为什么?
#!/bin/bash
for file in *.ats;
do
if [[ ("${file}" = THx) || ("${file}" = THy)]]
then cp $file /home/milenko/procmt
fi
done
目录中的文件
262_V01_C00_R000_TEx_BL_128H.ats
262_V01_C01_R000_TEy_BL_128H.ats
262_V01_C02_R000_THx_BL_128H.ats
262_V01_C03_R000_THy_BL_128H.ats
我想复制包含 THx 或 THy 的文件,但是文件没有被复制。为什么?
cp *_TH[xy]_*.ats /home/milenk/procmt/
?根本没有循环的必要。 - Charles Duffy