while read line;
do if -f live_photos/$line;
then cp live_photos/$line other_live_photos
fi; done < other_live_photos.csv
这里有什么问题?我在接近完成时收到一个意外令牌,错误。
other_live_photos.csv 基本上是一组文件名。
如果您有一个示例文件,这会有所帮助,这样我们就可以确定过滤条件是什么。基于other_live_photos.csv
其中不包含字符串的其他条目的想法live_photos
:
while read line
do
livePhotos=$(grep live_photos $line)
cp $livePhotos other_live_photos
done < other_live_photos.csv
如果它是文件中的每个行项目,则只需排除变量:
while read line
do
cp $line other_live_photos
done < other_live_photos.csv
如果您$line
在移动文件之前尝试确定该文件是否存在(如果它不存在,它将做什么?什么都没有),那么:
while read line
do
if [ -f $line ]
then
cp live_photos/$line other_live_photos
fi
done < other_live_photos.csv
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句