Jus*_*tin 0 tar gzip pipe wget
我想下载一个大文件是.tar.gz和(> 2GB)的大小。bash 脚本还做了很多其他的事情,所以我想开始下载,然后继续处理 bash 脚本中的其他命令。我正在使用wget并通过管道tar在后台运行它&。
wget -q "https://download-of-large-file-here.tar.gz" | tar xz &
# other commands here
Run Code Online (Sandbox Code Playgroud)
然而,这打破了:
gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now
Run Code Online (Sandbox Code Playgroud)
知道如何进行这项工作吗?
您必须指示wget写入 STDOUT,您可以通过传递-O -给 wget 来执行此操作,否则会将文件保存到磁盘。tar失败是因为在执行时它期待来自 STDIN 的东西。
这应该有效:
wget -q -O - "https://download-of-large-file-here.tar.gz" | tar xz &
Run Code Online (Sandbox Code Playgroud)
Where-q抑制来自 STDOUT 的默认进度信息-O -并将输出文件设置为 STDOUT。
| 归档时间: |
|
| 查看次数: |
3979 次 |
| 最近记录: |