【发布时间】:2011-06-05 07:34:53
【问题描述】:
这会打印你的 shell 什么?
echo foo | while read line; do echo $line; done < <(echo bar)
我希望它评估为 echo foo | bar 或 foo < <(bar),这两者都会导致错误消息。
在 Bash 4.1.5 中,管道似乎被简单地丢弃了:
bar
在短跑中:
sh: Syntax error: redirection unexpected
【问题讨论】:
-
为什么重要?这是糟糕的设计,您不应多次重定向标准输入。
-
这更像是一种心理锻炼——我刚刚意识到它是有效的语法,它应该用它做一些“合理”的事情。
标签: bash shell redirect dash-shell