【发布时间】:2015-11-06 18:12:20
【问题描述】:
我想做下面的动作
for(File : find - ".java"){
// here i will do grep on the file, i want to process each file separetely
}
在 bash 中有什么方法可以做到这一点?
【问题讨论】:
我想做下面的动作
for(File : find - ".java"){
// here i will do grep on the file, i want to process each file separetely
}
在 bash 中有什么方法可以做到这一点?
【问题讨论】:
只需使用process substitution:
while IFS= read -r name;
do
# do things with $name, which contains the name of the file
done < <(find -type f -name "*.java")
【讨论】: