bash code :
if [ $# -ne 1 ];
then
echo “Usage is $0 basepath”;
exit
fi
path=$1
declare -A statarray;
while read line;
do
ftype=`file -b "$line" | cut -d, -f1`
let statarray["$ftype"]++;
done < <(find $path -type f -print)
echo ============ File types and counts =============
for ftype in "${!statarray[@]}";
do
echo $ftype : ${statarray["$ftype"]}
done
这段代码是linux脚本攻略里面的,看到 done < <(find $path -type f -print) 时看不懂了,done 后面接<< ,
不明白什么意思 done < <(find $path -type f -print)
-
- 帖子: 3
- 注册时间: 2013-11-23 15:24
- 系统: ubuntu 10.11
- susbarbatus
- 帖子: 2966
- 注册时间: 2010-04-10 16:14
- 系统: Arch Linux
Re: 不明白什么意思 done < <(find $path -type f -print)
不是 done 后面接 << , 这两个 < 是分开的,
第一个 < 是输入重定向,后面的 <(...) 是一起的,是 Process Substitution,
这两个组合在一起的效果类似管道,就是把<()里的执行结果作为输入传给前面的循环。
第一个 < 是输入重定向,后面的 <(...) 是一起的,是 Process Substitution,
这两个组合在一起的效果类似管道,就是把<()里的执行结果作为输入传给前面的循环。
沉迷将棋中……