1
我已经在做所有我的目录for loop
内部从abcd它开始工作。但是当我在根目录中有其他文件或东西时,它会在第一次循环后崩溃。bash for循环所有目录并执行内部命令
dir_1="./some/path1"
dir_2="./some/path2"
dir_3="./some/path3"
for f in ./abcd*;
do
[ -d $f ] && cd "$f" && echo I am inside $f
find $dir_1 -name something*.txt -exec cp {} $dir_3 \;
find $dir_2 -name another*.txt -exec cp {} $dir_3 \;
cd "$dir_3"
# do some other stuff here
cd ../../..
done;
有人可以帮我修理吗?