for i in $(ls);do if [ $i = '*.java' ];then echo "I do something with the file $i" fi done
我想遍历当前文件夹中的每个文件,并检查它是否与特定扩展名匹配.上面的代码不起作用,你知道为什么吗?
bash glob file
bash ×1
file ×1
glob ×1