代码如下:
pwd_dir=$(pwd)
#!/bin/sh
#============ get the file name ===========
sort_name=".bag" #从当前目录中筛选出特定的文件名
for file_a in ${pwd_dir}/*; do
temp_file=`basename $file_a`
if [[ "$temp_file" == *"$sort_name"* ]];then
echo $temp_file
fi
done