【发布时间】:2017-04-09 10:41:09
【问题描述】:
更容易显示为试图用文字来描述。
find . -name jo\* -print > list
cat list
#./jo1
#./jo2
#./jo3
# the "file" by reading the list of files from the file "list"
file -f list
#./jo1: ASCII text
#./jo2: ASCII text
#./jo3: ASCII text
#now with process substitution
file -f <(find . -name jo\* -print)
什么都不输出.. ;(
#repeat with -x
set -x
file -f <(find . -name jo\* -print)
set +x
#shows
+ file -f /dev/fd/63
++ find . -name 'jo*' -print
+ set +x
所以,它应该工作。但没有。为什么?
编辑
请注意 - 进程替换应该在您应该输入文件名的任何地方都起作用,比如说:
diff <(some command) <(another command)
上面使用的bash
diff /dev/fd/... /dev/fd/...
例如在grep - 你可以使用:
grep -f <(command_for_produce_the_patterns) files..
同样,bash 在内部将其用作
grep -f /dev/fd/63 files....
所以,同样的应该在file
file -f <(command)
【问题讨论】: