修复体上的焦油巢
以下是 tar 已知且长期存在的不一致/功能吗?我怀疑答案是肯定的。
cd mydir
tar cvpf dec14.tar .
tar xvpf dec14.tar -C .
文件被提取到它们应该在的位置。
cd ..
tar cvpf dec14.tar mydir
tar xvpf dec14.tar -C mydir
文件被恢复为嵌套在 mydir/mydir 中,换句话说,嵌套比以前低一级。
Is the following a known and long-standing inconsistency/feature of tar? I suspect the answer is yes.
cd mydir
tar cvpf dec14.tar .
tar xvpf dec14.tar -C .
Files are extracted to where they are supposed to be.
cd ..
tar cvpf dec14.tar mydir
tar xvpf dec14.tar -C mydir
Files are restored nested in mydir/mydir, in other words, nested one level lower than before.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,这不是不一致或错误。 'tar' 正在完全按照您的指示执行操作。 “-C”选项只是意味着首先更改到给定的目录,它并不意味着从提取的路径中删除该字符串。
No, it's not an inconsistency or bug. 'tar' is doing exactly what you told it to do. The '-C' option just means to change into the given directory first, it doesn't imply anything about trimming that string off the extracted paths.