为什么管道命令对我不起作用?

时间:2010-12-05 23:54:07

标签: bash pipe named-pipes

实际上在my last question我试图使用pipe命令。我正在查看Process Substitution - Advanced Bash-Scripting Guide中的示例。

我尝试过以下几行:

 bzip2 -c < pipe > file.tar.bz2 & 
 tar cf pipe $directory_name 
 rm pipe

但他们失败并出现错误:

pipe: No such file or directory. 

这里发生了什么?这是ABS指南中的错误吗?

1 个答案:

答案 0 :(得分:2)

您正在使用的示例似乎假设名为“pipe”的命名管道已存在于当前目录中。这里的“管道”:

bzip2 -c < pipe > file.tar.bz2 &

不是命令名,它是恰好是命名管道的文件名。请阅读“mkfifo”和“命名管道”以获取更多信息。