for i in $(ls);do if [ $i = '*.java' ];then echo "I do something with the file $i" fi done
不需要花哨的技巧:
for i in *.java; do ... done
for i in $(ls);do if [ $i = '*.java' ];then echo "I do something with the file $i" fi done
for i in *.java; do ... done