拷贝以下代码,保存为.sh文件执行
#!/bin/bash
dir_arr=$(find -name "*h" -print;)
temp_path="temp_path.txt"
if [ -f $temp_path ]; then
rm -r $temp_path
fi
for dir in ${dir_arr[*]}
do
find $dir -type f >> $temp_path
done
for file in $(awk -F '/' '{print $NF}' $temp_path | sort | uniq -d)
do
echo $file
done

本文介绍了一个bash脚本,用于批量查找特定类型的文件,并将它们的路径输出到文件中。脚本首先检查是否存在旧的临时路径文件,然后遍历指定目录下所有包含特定后缀的文件,收集其路径并输出。
919

被折叠的 条评论
为什么被折叠?



