为什么我的shell脚本会创建一个名为pipe的文件? [英] Why does my shell script create a file named pipe?
本文介绍了为什么我的shell脚本会创建一个名为pipe的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个简单的设置:
pwd
/home/abc/pipetest
ls
mydir pipetest.sh
现在我要做:
./pipetest.sh
然后我得到
ls
file.tar.bz2 mydir pipe pipetest.sh
我的问题是:为什么创建了名为pipe的文件?它包含一些无法使用vi看到的字符.发生了什么事?
My question is: Why did the file named pipe get created? It contains some characters that could not be seen using vi. What's going on?
pipetest.sh包含:
pipetest.sh contains:
#!/bin/sh
directory_name=mydir
tar cf pipe $directory_name
bzip2 -c < pipe > file.tar.bz2
推荐答案
tar cf pipe $directory_name
将tar文件写入名为pipe
的文件.
tar cf pipe $directory_name
writes the tar file to a file named pipe
.
您要使用的是实际管道:
What you want to do is using the actual pipe:
tar c $directory_name | bzip2 > file.tar.bz2
或者简单地使用
tar cjf file.tar.bz2 $directory_name
这篇关于为什么我的shell脚本会创建一个名为pipe的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文