shell遍历当前目录
代码】shell遍历当前目录。
·
linux $'\r': command not found
yum install dos2unix
dos2unix test.sh
#!/bin/bash
for dir in `ls` ;do
echo $dir
done
#!/bin/bash
function delete (){
rm -f *.d
rm -f *.o
}
for file in * ;do
dir_name="`pwd`/$file"
echo $dir_name
if test -d $dir_name
then
delete
cd $file
delete
for file2 in * ;do
#echo $file2
#echo "`pwd`/$file2/src/*.d"
rm -f "`pwd`/$file2/src/*.d"
rm -f "`pwd`/$file2/src/*.o"
done
cd -
fi
done
更多推荐
已为社区贡献2条内容
所有评论(0)