为什么我的 shell 脚本会创建一个名为 pipeline 的文件?

发布于 2024-10-06 04:10:13 字数 445 浏览 0 评论 0原文

我有这个简单的设置:

pwd
/home/abc/pipetest

ls
mydir  pipetest.sh

现在我做:

 ./pipetest.sh

然后我得到

  ls
  file.tar.bz2  mydir  pipe  pipetest.sh

我的问题是: 为什么创建名为 pipeline 的文件?它包含一些使用 vi 无法看到的字符。这是怎么回事?

pipelinetest.sh 包含:

#!/bin/sh

directory_name=mydir
tar cf pipe $directory_name
bzip2 -c < pipe > file.tar.bz2

I have this simple set up:

pwd
/home/abc/pipetest

ls
mydir  pipetest.sh

Now I do:

 ./pipetest.sh

And then I get

  ls
  file.tar.bz2  mydir  pipe  pipetest.sh

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 contains:

#!/bin/sh

directory_name=mydir
tar cf pipe $directory_name
bzip2 -c < pipe > file.tar.bz2

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

吹泡泡o 2024-10-13 04:10:13

tar cf pipe $directory_name 将 tar 文件写入名为 pipe 的文件中。

你想要做的是使用实际的管道:

tar c $directory_name | bzip2 > file.tar.bz2

或者简单地使用

tar cjf file.tar.bz2 $directory_name

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

Or simply use

tar cjf file.tar.bz2 $directory_name
向地狱狂奔 2024-10-13 04:10:13
tar -cf pipe

在当前目录中创建一个名为“pipe”的 tar 文件。

tar -cf pipe

creates a tar file named "pipe" in the current directory.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文