Shell 中 `< <(command args)` 是什麼意思?
while IFS= read -r -d $'\0' file; do
dosomethingwith "$file" # 對每個檔案進行處理
done < <(find /bar -name *foo* -print0)
<() 在手冊中稱為 process substitution,它類似於管線,但會傳遞 /dev/fd/63 這種形式的參數,而不是使用 stdin。
< 會從命令列指定的檔案讀取輸入。
這兩個運算子合起來的作用與管線完全相同,因此可以改寫為:
find /bar -name *foo* -print0 | while read line; do
...
done
